Gamegui Button anpassen

This commit is contained in:
zhe 2021-12-13 09:41:27 +01:00
parent b607886184
commit 75096139ac

View File

@ -11,28 +11,30 @@ public class GameGui {
public GameGui(){ public GameGui(){
frame = new JFrame("Tetris"); frame = new JFrame("Tetris");
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createMatteBorder(400, 10, 10, 10,Color.black)); panel.setBorder(BorderFactory.createMatteBorder(500, 10, 10, 50,Color.black));
//Label //Label
JLabel label = new JLabel(" Ihr Name:"); //JLabel label = new JLabel(" Ihr Name:");
panel.add(label); //panel.add(label);
//Textfeld //Textfeld
JTextField tfName = new JTextField("Bitte Name eingeben"); //JTextField tfName = new JTextField("Bitte Name eingeben");
tfName.setForeground(Color.white); //tfName.setForeground(Color.white);
// Hintergrundfarbe wird gesetzt // Hintergrundfarbe wird gesetzt
tfName.setBackground(Color.GRAY); // tfName.setBackground(Color.GRAY);
// Textfeld wird unserem Panel hinzugefügt // Textfeld wird unserem Panel hinzugefügt
panel.add(tfName); //panel.add(tfName);
//Button //Button
JButton button1 = new JButton("Start"); //JButton button1 = new JButton("Start");
button1.setPreferredSize( new Dimension(150,50)); //button1.setPreferredSize( new Dimension(150,50));
JButton button2 = new JButton("Pause"); JButton button2 = new JButton("Pause");
button2.setPreferredSize( new Dimension(100,30));
JButton button3 = new JButton("Score"); JButton button3 = new JButton("Score");
button3.setPreferredSize( new Dimension(100,30));
//Button untereinander //Button untereinander
panel.setLayout(new GridLayout(0,1)); panel.setLayout(new GridLayout(0,1));
panel.setBackground(Color.LIGHT_GRAY); panel.setBackground(Color.LIGHT_GRAY);
panel.add(button1); //panel.add(button1);
panel.add(button2); panel.add(button2);
panel.add(button3); panel.add(button3);