Keines MainFrame mit Windowbuilder erstellt.

devGameUi
Matias 2025-06-09 18:13:41 +02:00
parent 279167faaf
commit 1d4ae4abdb
6 changed files with 119 additions and 3 deletions

View File

@ -9,12 +9,13 @@ import de.mannheim.th.chess.ui.Ui;
*/ */
public class App { public class App {
private Ui userinterface = new Ui(); private static Ui userinterface;
/** /**
* Main-Methode. * Main-Methode.
* @param args * @param args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Hello World!"); System.out.println("Hello World!");
userinterface = new Ui();
} }
} }

View File

@ -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);
}
}

View File

@ -1,5 +1,6 @@
package de.mannheim.th.chess.ui; package de.mannheim.th.chess.ui;
import java.awt.EventQueue;
import java.util.ArrayList; import java.util.ArrayList;
import de.mannheim.th.chess.utl.GameReader; import de.mannheim.th.chess.utl.GameReader;
@ -11,8 +12,11 @@ public class Ui{
private ArrayList<GameWindow> gamewindows = new ArrayList<>(); private ArrayList<GameWindow> gamewindows = new ArrayList<>();
private GameReader reader = new GameReader(); private GameReader reader = new GameReader();
private MainFrame mf;
public Ui() { public Ui() {
mf = new MainFrame();
mf.setVisible(true);
} }
} }

View File

@ -1 +1 @@
de/mannheim/th/chess/App.class de\mannheim\th\chess\App.class

View File

@ -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