-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.java
40 lines (27 loc) · 945 Bytes
/
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
import javax.swing.*;
public class GUI extends JFrame{
public static void main(String[] args) {
new GUI();
}
private JPanel panel; // To reference a panel
private JLabel messageLabel; // To reference a label
private JTextField kiloTextField; // To reference a text field
private JButton calcButton; // To reference a button
private final int WINDOW_WIDTH = 1000; // Window width
private final int WINDOW_HEIGHT = 600;// Window height
public GUI() {
setTitle("Testing");
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buildPanel();
add(panel);
setVisible(true);
}
private void buildPanel() {
messageLabel = new JLabel ("Instructions");
calcButton = new JButton("Text");
panel = new JPanel();
panel.add(messageLabel);
panel.add(calcButton);
}
}