-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplay.java
51 lines (38 loc) · 864 Bytes
/
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
package Projects;
import java.awt.*;
import javax.swing.*;
public class Display extends JFrame {
private Container c;
private int x;
private int y;
public Display() {
super("Generic App Window");
c = this.getContentPane();
setPreferredSize(new Dimension(800,600));
showFrame();
}
public Display(int x, int y) {
super("2nd");
this.x = y;
this.y = y;
setPreferredSize(new Dimension(x,y));
addLabel();
DaveMenu menu = new DaveMenu();
add(menu);
showFrame();
}
public void showFrame(){
this.setLocation(350,50);
this.pack();
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void addLabel() {
JLabel label = new JLabel("hello");
add(label);
}
public static void main(String args []) {
Display d2 = new Display(500,300);
d2 = new Display();
}
}