-
Notifications
You must be signed in to change notification settings - Fork 1
/
GUI.java
57 lines (43 loc) · 1.26 KB
/
GUI.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
55
56
57
package Main;
import javax.swing.*;
import java.awt.*;
public class GUI extends JFrame {
private String t;
public int w;
public int h;
private Canvas sceneMain = new Canvas();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
public int getScreenHeight() {
return screenSize.height;
}
public int getScreenWidth() {
return screenSize.width;
}
public GUI(String t, int w, int h) {
setLayout(new BorderLayout());
setSize(w, h);
setTitle(t);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocation(getScreenWidth() / 4,getScreenHeight() / 4);
setVisible(true);
sceneMain.setPreferredSize(new Dimension(w,h));
sceneMain.setMaximumSize(new Dimension(w,h));
sceneMain.setMinimumSize(new Dimension(w,h));
sceneMain.setFocusable(false);
add(sceneMain);
pack();
}
public Canvas getSceneMain(){
return sceneMain;
}
public JFrame getFrame(){
return this;
}
// public void setFrame(String t, int w, int h) {
// this.t = t;
// this.w = w;
// this.h = h;
//
// }
}