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;
|
||||
|
||||
public Board() {
|
||||
|
||||
loop = new Timer(delay, new ActionListener() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int row = 0; row < BOARD_HEIGHT+1; row++) {
|
||||
@ -83,9 +83,9 @@ public class Board extends JPanel implements KeyListener
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if(e.getKeyChar() == KeyEvent.VK_SPACE){
|
||||
delayTime=fast;
|
||||
}
|
||||
if(e.getKeyChar() == KeyEvent.VK_SPACE){
|
||||
delayTime=fast;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,10 +9,10 @@ public class GameGui {
|
||||
|
||||
//Zhe Wang-Holkenbrink
|
||||
public GameGui(){
|
||||
|
||||
frame = new JFrame("Tetris");
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBorder(BorderFactory.createMatteBorder(400, 10, 10, 10,Color.black));
|
||||
/*
|
||||
|
||||
//Label
|
||||
JLabel label = new JLabel(" Ihr Name:");
|
||||
panel.add(label);
|
||||
@ -29,14 +29,13 @@ public class GameGui {
|
||||
button1.setPreferredSize( new Dimension(150,50));
|
||||
JButton button2 = new JButton("Pause");
|
||||
JButton button3 = new JButton("Score");
|
||||
|
||||
//Button untereinander
|
||||
panel.setLayout(new GridLayout(0,1));
|
||||
panel.setBackground(Color.LIGHT_GRAY);
|
||||
panel.add(button1);
|
||||
panel.add(button2);
|
||||
panel.add(button3);
|
||||
*/
|
||||
frame = new JFrame("Tetris");
|
||||
|
||||
frame.add(panel,BorderLayout.EAST);
|
||||
frame.setSize(width,height);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
@ -45,6 +44,7 @@ public class GameGui {
|
||||
board = new Board();
|
||||
frame.addKeyListener(board);
|
||||
frame.add(board,BorderLayout.CENTER);
|
||||
frame.requestFocusInWindow();
|
||||
}
|
||||
public static void main(String [] args)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user