Problem mit Button und Label aufgehoben
This commit is contained in:
parent
d8d6b9d33c
commit
4d0f9a10ba
Binary file not shown.
Binary file not shown.
@ -32,6 +32,7 @@ public class Board extends JPanel implements KeyListener
|
|||||||
private int delayTime = normal;
|
private int delayTime = normal;
|
||||||
|
|
||||||
public Board() {
|
public Board() {
|
||||||
|
|
||||||
loop = new Timer(delay, new ActionListener() {
|
loop = new Timer(delay, new ActionListener() {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
@ -64,7 +65,6 @@ public class Board extends JPanel implements KeyListener
|
|||||||
g.fillRect(col*BLOCK_SIZE+x*BLOCK_SIZE,row*BLOCK_SIZE+y*BLOCK_SIZE,BLOCK_SIZE,BLOCK_SIZE);
|
g.fillRect(col*BLOCK_SIZE+x*BLOCK_SIZE,row*BLOCK_SIZE+y*BLOCK_SIZE,BLOCK_SIZE,BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int row = 0; row < BOARD_HEIGHT+1; row++) {
|
for (int row = 0; row < BOARD_HEIGHT+1; row++) {
|
||||||
|
@ -9,10 +9,10 @@ public class GameGui {
|
|||||||
|
|
||||||
//Zhe Wang-Holkenbrink
|
//Zhe Wang-Holkenbrink
|
||||||
public GameGui(){
|
public GameGui(){
|
||||||
|
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(400, 10, 10, 10,Color.black));
|
||||||
/*
|
|
||||||
//Label
|
//Label
|
||||||
JLabel label = new JLabel(" Ihr Name:");
|
JLabel label = new JLabel(" Ihr Name:");
|
||||||
panel.add(label);
|
panel.add(label);
|
||||||
@ -29,14 +29,13 @@ public class GameGui {
|
|||||||
button1.setPreferredSize( new Dimension(150,50));
|
button1.setPreferredSize( new Dimension(150,50));
|
||||||
JButton button2 = new JButton("Pause");
|
JButton button2 = new JButton("Pause");
|
||||||
JButton button3 = new JButton("Score");
|
JButton button3 = new JButton("Score");
|
||||||
|
//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);
|
||||||
*/
|
|
||||||
frame = new JFrame("Tetris");
|
|
||||||
frame.add(panel,BorderLayout.EAST);
|
frame.add(panel,BorderLayout.EAST);
|
||||||
frame.setSize(width,height);
|
frame.setSize(width,height);
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
@ -45,6 +44,7 @@ public class GameGui {
|
|||||||
board = new Board();
|
board = new Board();
|
||||||
frame.addKeyListener(board);
|
frame.addKeyListener(board);
|
||||||
frame.add(board,BorderLayout.CENTER);
|
frame.add(board,BorderLayout.CENTER);
|
||||||
|
frame.requestFocusInWindow();
|
||||||
}
|
}
|
||||||
public static void main(String [] args)
|
public static void main(String [] args)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user