-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTextAreaPane.java
More file actions
44 lines (33 loc) · 1016 Bytes
/
TextAreaPane.java
File metadata and controls
44 lines (33 loc) · 1016 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
package gui;
/**
* RUN:
* javac -cp .; gui/TextAreaPane.java && java -cp .; gui.TextAreaPane
* OUTPUT:
*
*/
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import net.mindview.util.*;
public class TextAreaPane extends JFrame {
private static final int WIDTH = 475;
private static final int HEIHGT = 425;
private JButton b = new JButton("Add Text");
private JTextArea ta = new JTextArea();
private static Generator sg = new RandomGenerator.String(7);
public TextAreaPane() {
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < 10; i++) {
ta.append(sg.next() + "\n");
}
}
});
add(new JScrollPane(ta));
add(BorderLayout.SOUTH, b);
}
public static void main(String[] args) {
SwingConsole.run(new TextAreaPane(), WIDTH, HEIHGT);
}
}