-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplay.java
More file actions
34 lines (22 loc) · 819 Bytes
/
Display.java
File metadata and controls
34 lines (22 loc) · 819 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
package Graphics;
import java.awt.Canvas;
import java.awt.Dimension;
import javax.swing.JFrame;
public class Display extends Canvas{
private static final long serialVersionUID = 1L;
public Display(int width,int height, String title,Render render){
Window(width,height,title,render);
}
private void Window(int width,int height, String title,Render render){
JFrame frame = new JFrame(title);
frame.setPreferredSize(new Dimension(width,height));
frame.setMaximumSize(new Dimension(width,height));
frame.setMinimumSize(new Dimension(width,height));
frame.setUndecorated(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.add(render);
frame.setVisible(true);
}
}