Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
39 lines (32 loc) · 1.2 KB

File metadata and controls

executable file
·
39 lines (32 loc) · 1.2 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TextArea1 {
JTextArea textArea;
public static void main(String[] args) {
TextArea1 ta = new TextArea1();
ta.go();
}
public void go() {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JButton button = new JButton("Just Click It");
button.addActionListener(new buttonListener());
textArea = new JTextArea(10,20);
textArea.setLineWrap(true);
JScrollPane scroller = new JScrollPane(textArea);
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
panel.add(scroller);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(BorderLayout.CENTER,panel);
frame.getContentPane().add(BorderLayout.SOUTH,button);
frame.setSize(350,300);
frame.setVisible(true);
}
class buttonListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
textArea.append("button clicked \n");
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.