-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.java
54 lines (35 loc) · 1.17 KB
/
display.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package launcher;
import java.awt.Canvas;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class display {
public JFrame frame;
private Canvas canvas;
private String title;
private int height, width;
public display(String title,int width, int height){
this.title=title;
this.width=width;
this.height=height;
createDisplay();
}
private void createDisplay(){
frame= new JFrame(title);
frame.setSize(width,height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(true);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
canvas= new Canvas();
canvas.setPreferredSize(new Dimension(width,height));
canvas.setMaximumSize(new Dimension(width,height));
canvas.setMinimumSize(new Dimension(width,height));
frame.add(canvas);
frame.pack();
}
public Canvas getCanvas(){
return canvas;
}
}