![]()
package zym.lesson17;
import java.awt.Container;
import java.awt.TextArea;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class JScrollDemo_01 extends JFrame {
public JScrollDemo_01(){
//容器
Container container=this.getContentPane();
//文本域
JTextArea jTextArea = new JTextArea(20,20);
jTextArea.setText("欢迎学习JTextArea");
//ScrollPane 下拉面板
JScrollPane jScrollPane =new JScrollPane(jTextArea);
container.add(jScrollPane);
this.setTitle("lesson17——JScrollDemo_01");
this.setSize(400, 200);
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new JScrollDemo_01();
}
}