buat tetris dari java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package tetris;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Tetris extends JFrame {
JLabel statusbar;
public Tetris() {
statusbar = new JLabel(" 0");
add(statusbar, BorderLayout.SOUTH);
Board board = new Board(this);
add(board);
board.start();
setSize(200, 400);
setTitle("Tetris");
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public JLabel getStatusBar() {
return statusbar;
}
public static void main(String[] args) {
Tetris game = new Tetris();
game.setLocationRelativeTo(null);
game.setVisible(true);
}
}
Rikazuki 09