button
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -36,7 +36,7 @@ public class Board extends JPanel
 | 
			
		||||
  protected void paintComponent(Graphics g) {
 | 
			
		||||
    super.paintComponent(g);
 | 
			
		||||
    g.fillRect(0, 0, getWidth(), getHeight());
 | 
			
		||||
    g.setColor(Color.DARK_GRAY);
 | 
			
		||||
    g.setColor(Color.lightGray);
 | 
			
		||||
 | 
			
		||||
    //shape mit 2-Forschleife
 | 
			
		||||
    for(int row=0;row< shape.length;row++){
 | 
			
		||||
 
 | 
			
		||||
@@ -10,19 +10,26 @@ public class GameGui {
 | 
			
		||||
    public GameGui(){
 | 
			
		||||
 | 
			
		||||
        JPanel panel = new JPanel();
 | 
			
		||||
        panel.setBorder(BorderFactory.createMatteBorder(450, 10, 20, 10,Color.black));
 | 
			
		||||
        panel.setBorder(BorderFactory.createMatteBorder(400, 10, 20, 10,Color.black));
 | 
			
		||||
        //Label
 | 
			
		||||
        JLabel label = new JLabel(" Ihr Name:");
 | 
			
		||||
        panel.add(label);
 | 
			
		||||
        //Textfeld
 | 
			
		||||
        JTextField tfName = new JTextField("Bitte Name eingeben");
 | 
			
		||||
        tfName.setForeground(Color.white);
 | 
			
		||||
        // Hintergrundfarbe wird gesetzt
 | 
			
		||||
        tfName.setBackground(Color.GRAY);
 | 
			
		||||
        // Textfeld wird unserem Panel hinzugefügt
 | 
			
		||||
        panel.add(tfName);
 | 
			
		||||
 | 
			
		||||
        JLabel label = new JLabel("Name: ",JLabel.LEFT);
 | 
			
		||||
        label.setBounds(100,100,50,30);
 | 
			
		||||
        //Button
 | 
			
		||||
        JButton button1 = new JButton("Start");
 | 
			
		||||
 | 
			
		||||
        button1.setPreferredSize( new Dimension(150,150));
 | 
			
		||||
        JButton button2 = new JButton("Pause");
 | 
			
		||||
        JButton button3 = new JButton("Score");
 | 
			
		||||
 | 
			
		||||
        panel.setLayout(new GridLayout(0,1));
 | 
			
		||||
        panel.setBackground(Color.gray);
 | 
			
		||||
        panel.add(label);
 | 
			
		||||
        panel.setBackground(Color.LIGHT_GRAY);
 | 
			
		||||
        panel.add(button1);
 | 
			
		||||
        panel.add(button2);
 | 
			
		||||
        panel.add(button3);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user