-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTetrisViewer.java
More file actions
40 lines (31 loc) · 854 Bytes
/
Copy pathTetrisViewer.java
File metadata and controls
40 lines (31 loc) · 854 Bytes
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
37
38
39
40
package se.liu.thebo717.tetris;
import javax.swing.*;
import java.awt.*;
public class TetrisViewer
{
private TetrisComponent tetrisComponent;
private JFrame frame = new JFrame();
private BarComponent barComponent;
private Board board;
public TetrisViewer(final Board board) {
tetrisComponent = new TetrisComponent(board);
barComponent = new BarComponent(board);
}
public JFrame getFrame() {
return frame;
}
public TetrisComponent getTetrisComponent() {
return tetrisComponent;
}
public BarComponent getBarComponent() {
return barComponent;
}
public void show(){
frame.setJMenuBar(barComponent.getMenuBar());
frame.setLayout(new BorderLayout());
frame.add(tetrisComponent);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}