diff --git a/src/main/java/de/mannheim/th/chess/App.java b/src/main/java/de/mannheim/th/chess/App.java index 17af5c1..f5a76cc 100644 --- a/src/main/java/de/mannheim/th/chess/App.java +++ b/src/main/java/de/mannheim/th/chess/App.java @@ -9,12 +9,13 @@ import de.mannheim.th.chess.ui.Ui; */ public class App { - private Ui userinterface = new Ui(); + private static Ui userinterface; /** * Main-Methode. * @param args */ public static void main(String[] args) { System.out.println("Hello World!"); + userinterface = new Ui(); } } diff --git a/src/main/java/de/mannheim/th/chess/ui/MainFrame.java b/src/main/java/de/mannheim/th/chess/ui/MainFrame.java new file mode 100644 index 0000000..5203688 --- /dev/null +++ b/src/main/java/de/mannheim/th/chess/ui/MainFrame.java @@ -0,0 +1,102 @@ +package de.mannheim.th.chess.ui; + +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JTextField; +import javax.swing.JLabel; +import java.awt.GridLayout; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Font; +import java.awt.Color; + +public class MainFrame extends JFrame { + + private static final long serialVersionUID = 1L; + private JPanel contentPane; + + /** + * Launch the application. + */ +// public static void main(String[] args) { +// EventQueue.invokeLater(new Runnable() { +// public void run() { +// try { +// MainFrame frame = new MainFrame(); +// frame.setVisible(true); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// }); +// } + + /** + * Create the frame. + */ + public MainFrame() { + + setBackground(Color.WHITE); + setResizable(false); + setAlwaysOnTop(true); + setTitle("Schach"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 500, 500); + contentPane = new JPanel(); + contentPane.setBackground(Color.GRAY); + contentPane.setForeground(Color.GRAY); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + + setContentPane(contentPane); + contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); + + contentPane.add(Box.createVerticalStrut(10)); + + JLabel lblNewLabel = new JLabel("Schach"); + lblNewLabel.setFont(new Font("Serif", Font.BOLD, 60)); + lblNewLabel.setAlignmentX(Component.CENTER_ALIGNMENT); + contentPane.add(lblNewLabel); + + contentPane.add(Box.createVerticalStrut(10)); + + JLabel lblNewLabel_1 = new JLabel("by Dominik, Marius und Matias"); + lblNewLabel_1.setFont(new Font("Calibri", Font.ITALIC, 24)); + lblNewLabel_1.setAlignmentX(Component.CENTER_ALIGNMENT); + contentPane.add(lblNewLabel_1); + + contentPane.add(Box.createVerticalStrut(75)); + + JButton btnNewButton = new JButton("Neues Spiel starten"); + btnNewButton.setBackground(Color.LIGHT_GRAY); + btnNewButton.setForeground(Color.BLACK); + btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 16)); + btnNewButton.setAlignmentX(Component.CENTER_ALIGNMENT); + contentPane.add(btnNewButton); + + contentPane.add(Box.createVerticalStrut(15)); + + JButton btnNewButton_1 = new JButton("Vergangenes Spiel laden"); + btnNewButton_1.setBackground(Color.LIGHT_GRAY); + btnNewButton_1.setForeground(Color.BLACK); + btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 16)); + btnNewButton_1.setAlignmentX(Component.CENTER_ALIGNMENT); + contentPane.add(btnNewButton_1); + + contentPane.add(Box.createVerticalStrut(15)); + + JButton btnNewButton_2 = new JButton("Spiel beenden"); + btnNewButton_2.setBackground(Color.LIGHT_GRAY); + btnNewButton_2.setForeground(Color.BLACK); + btnNewButton_2.setFont(new Font("Tahoma", Font.BOLD, 16)); + btnNewButton_2.setAlignmentX(Component.CENTER_ALIGNMENT); + contentPane.add(btnNewButton_2); + + } +} diff --git a/src/main/java/de/mannheim/th/chess/ui/Ui.java b/src/main/java/de/mannheim/th/chess/ui/Ui.java index 8af8c15..7c2563e 100644 --- a/src/main/java/de/mannheim/th/chess/ui/Ui.java +++ b/src/main/java/de/mannheim/th/chess/ui/Ui.java @@ -1,5 +1,6 @@ package de.mannheim.th.chess.ui; +import java.awt.EventQueue; import java.util.ArrayList; import de.mannheim.th.chess.utl.GameReader; @@ -11,8 +12,11 @@ public class Ui{ private ArrayList gamewindows = new ArrayList<>(); private GameReader reader = new GameReader(); + private MainFrame mf; public Ui() { + mf = new MainFrame(); + mf.setVisible(true); } } \ No newline at end of file diff --git a/target/classes/de/mannheim/th/chess/App.class b/target/classes/de/mannheim/th/chess/App.class index 26fbb12..06cb03b 100644 Binary files a/target/classes/de/mannheim/th/chess/App.class and b/target/classes/de/mannheim/th/chess/App.class differ diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index ce42402..ebf066f 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1 +1 @@ -de/mannheim/th/chess/App.class +de\mannheim\th\chess\App.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 0c39e4c..15c463f 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1 +1,10 @@ -/home/dominik/studium/2semester/prog/projects/chess/Schach/chess/src/main/java/de/mannheim/th/chess/App.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\App.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\domain\Game.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\domain\MoveChecker.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\domain\MoveReader.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\model\Database.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\ui\Creator.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\ui\GameWindow.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\ui\Ui.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\utl\Clock.java +C:\Users\matia\git\Schach\src\main\java\de\mannheim\th\chess\utl\GameReader.java