-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirstAppGUI.java
More file actions
46 lines (32 loc) · 984 Bytes
/
FirstAppGUI.java
File metadata and controls
46 lines (32 loc) · 984 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
35
36
37
38
39
40
41
42
43
44
45
46
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class FirstAppGUI {
private static class FirstDisplay extends JPanel {
public void paintComponent (Graphics g) {
super.paintComponent(g);
g.drawString("#SWAG", 20, 35);
}
}
private static class ButtonHandler implements ActionListener {
@Override
public void actionPerformed(ActionEvent ev) {
// System.exit(0);
JOptionPane.showMessageDialog(null, "bla 1", "bla bla 2", 0);
}
}
public static void main(String [] args) {
FirstDisplay fd = new FirstDisplay();
JButton button = new JButton("Cancel");
ButtonHandler bh = new ButtonHandler();
button.addActionListener(bh);
JPanel content = new JPanel();
content.setLayout(new BorderLayout());
content.add(fd, BorderLayout.CENTER);
content.add(button, BorderLayout.SOUTH);
JFrame win = new JFrame("YOLOOO");
win.setContentPane(content);
win.setSize(700, 300);
win.setVisible(true);
}
}