Button auf Gui
This commit is contained in:
parent
2215dc0ba7
commit
1839154769
Binary file not shown.
@ -61,5 +61,4 @@ public class Board extends JPanel
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,43 @@
|
|||||||
package Tetris;
|
package Tetris;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.*;
|
||||||
import javax.swing.JLabel;
|
import java.awt.*;
|
||||||
|
|
||||||
|
|
||||||
public class GameGui {
|
public class GameGui {
|
||||||
public static final int width= 500, height =650;
|
public static final int width= 500, height =650;
|
||||||
private Board board;
|
private Board board;
|
||||||
private JFrame window;
|
private JFrame frame;
|
||||||
|
|
||||||
public GameGui(){
|
public GameGui(){
|
||||||
window = new JFrame("Tetris");
|
frame = new JFrame("Tetris");
|
||||||
|
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(450, 30, 100, 30));
|
||||||
|
JButton button1 = new JButton("Start");
|
||||||
|
JButton button2 = new JButton("Pause");
|
||||||
|
|
||||||
|
panel.setLayout(new GridLayout(0,1));
|
||||||
|
panel.add(button1);
|
||||||
|
panel.add(button2);
|
||||||
|
/*
|
||||||
|
window.add(panel, BorderLayout.EAST);
|
||||||
|
frame.add(window,BorderLayout.WEST);
|
||||||
window.setSize(width,height);
|
window.setSize(width,height);
|
||||||
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
//window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
window.setResizable(false);
|
window.setResizable(false);
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
board = new Board();
|
board = new Board();
|
||||||
window.add(board);
|
window.add(board);
|
||||||
|
*/
|
||||||
|
|
||||||
|
frame.add(panel,BorderLayout.EAST);
|
||||||
|
frame.setSize(width,height);
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
frame.setResizable(false);
|
||||||
|
frame.setVisible(true);
|
||||||
|
board = new Board();
|
||||||
|
frame.add(board,BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
public static void main(String [] args)
|
public static void main(String [] args)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user