-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleGui.java
More file actions
45 lines (33 loc) · 1.08 KB
/
SimpleGui.java
File metadata and controls
45 lines (33 loc) · 1.08 KB
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
//lala lalai lalai lala lai lai
import javax.swing.*;
import javax.swing.event.AncestorListener;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.util.Random;
public class SimpleGui implements ActionListener {
private final JButton button;
private final JFrame frame;
public SimpleGui(JFrame frame, JButton button) {
this.frame = frame;
this.button = button;
}
public void go() {
button.addActionListener(this);
button.setMargin(new Insets(0, 0, 0, 0));
button.setPreferredSize(new Dimension(200, 200));
button.setSize(200, 200);
frame.getContentPane().add(button);
frame.setSize(1000, 1000);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent event) {
JTextField field = new JTextField(20);
JPanel panel = new JPanel();
//text.setLineWrap(true);
JFrame frame2 = new JFrame();
frame.dispose();
SimpleText st = new SimpleText(frame2, field, panel);
st.go();
}
}