Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- public class TextAreaDemoB extends JFrame {
- //============================================== instance variables
- JTextArea _resultArea = new JTextArea(6, 20);
- //====================================================== constructor
- public TextAreaDemoB() {
- String[] words = {"my","text","area"};
- for(String W : words)
- _resultArea.append(W + "\n");
- JScrollPane scrollingArea = new JScrollPane(_resultArea);
- //... Get the content pane, set layout, add to center
- JPanel content = new JPanel();
- content.setLayout(new BorderLayout());
- content.add(scrollingArea, BorderLayout.CENTER);
- //... Set window characteristics.
- this.setContentPane(content);
- this.setTitle("TextAreaDemo B");
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.pack();
- }
- //============================================================= main
- public static void main(String[] args) {
- JFrame win = new TextAreaDemoB();
- win.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement