-
Notifications
You must be signed in to change notification settings - Fork 0
/
Display.java
33 lines (24 loc) · 853 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
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class Foo{
public static void main(String[] args) {
JFrame f = new JFrame("A JFrame");
f.setSize(250, 250);
f.setLocation(300,200);
final JTextArea textArea = new JTextArea(10, 40);
f.getContentPane().add(BorderLayout.CENTER, textArea);
final JButton button = new JButton("Click Me");
f.getContentPane().add(BorderLayout.SOUTH, button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
textArea.append("Button was clicked\n");
}
};
f.setVisible(true);
}
}