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
| import javax.swing.*;
public class Test3 extends JPanel {
JTextArea jt;
JScrollPane jsp;
public Test3() {
super();
setSize(200,200);
jt = new JTextArea(1,10);
jt.setSize(getSize());
jt.setLineWrap(true);
jsp = new JScrollPane(jt);
add(jsp);
}
public static void main (String arg[]) {
Test3 t = new Test3();
JFrame frame = new JFrame();
frame.setContentPane(t);
frame.setSize(200,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
} |