92 lines
2.3 KiB
Java
92 lines
2.3 KiB
Java
package de.mannheim.th.chess.ui;
|
|
|
|
import java.awt.Color;
|
|
import java.awt.Component;
|
|
import java.awt.Dimension;
|
|
import java.awt.EventQueue;
|
|
import java.awt.Font;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
import java.util.ArrayList;
|
|
|
|
import javax.swing.Box;
|
|
import javax.swing.BoxLayout;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JComboBox;
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.border.EmptyBorder;
|
|
|
|
import de.mannheim.th.chess.domain.Game;
|
|
|
|
public class ModeSelectionFrame extends JFrame {
|
|
|
|
private ArrayList<Game> spiele = new ArrayList<>();
|
|
private static final long serialVersionUID = 1L;
|
|
private JPanel contentPane;
|
|
|
|
/**
|
|
* Create the frame.
|
|
*/
|
|
public ModeSelectionFrame() {
|
|
|
|
setBackground(Color.LIGHT_GRAY);
|
|
setResizable(true);
|
|
setAlwaysOnTop(true);
|
|
setTitle("Modeselection");
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
setBounds(100, 100, 400, 200);
|
|
|
|
contentPane = new JPanel();
|
|
contentPane.setBackground(new Color(90, 90, 90));
|
|
contentPane.setForeground(Color.BLACK);
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
|
|
|
setContentPane(contentPane);
|
|
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
|
|
|
|
|
|
|
|
JLabel jl = new JLabel("Welchen Modus wollen Sie spielen?");
|
|
jl.setFont(new Font("Calibri", Font.ITALIC, 24));
|
|
jl.setAlignmentX(Component.CENTER_ALIGNMENT);
|
|
contentPane.add(jl);
|
|
|
|
contentPane.add(Box.createVerticalStrut(15));
|
|
|
|
//Moduseingabe
|
|
String[] moeglichkeiten = { "Blitz", "Schnellschach", "Klassisch"};
|
|
JComboBox jcb1 = new JComboBox<String>(moeglichkeiten);
|
|
jcb1.setMaximumSize(new Dimension(100, 24));
|
|
contentPane.add(jcb1);
|
|
|
|
contentPane.add(Box.createVerticalStrut(15));
|
|
|
|
JButton btnNewButton = new JButton("Spiel starten");
|
|
|
|
btnNewButton.setBackground(Color.LIGHT_GRAY);
|
|
btnNewButton.setForeground(Color.BLACK);
|
|
btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 16));
|
|
btnNewButton.setAlignmentX(Component.CENTER_ALIGNMENT);
|
|
btnNewButton.addActionListener(new ActionListener() {
|
|
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
//Moduslogik
|
|
String modus = String.valueOf(jcb1.getSelectedItem());
|
|
Game g = new Game(modus);
|
|
|
|
spiele.add(g);
|
|
|
|
}
|
|
|
|
});
|
|
contentPane.add(btnNewButton);
|
|
|
|
setVisible(true);
|
|
}
|
|
|
|
}
|