62,614
社区成员
发帖
与我相关
我的任务
分享
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testJScrollPane;
import javax.swing.*;
/**
*
* @author Administrator
*/
public class JFrameClass extends JFrame{
public static final int DEFULT_WIDTH=320;
public static final int DEFULT_HEIGHT=120;
JTextArea textArea; //多行文本域
JScrollPane scrollPane; //带滚动视图的容器
public JFrameClass(){
textArea=new JTextArea(5,30); //创建多行文本域对象
scrollPane=new JScrollPane(textArea); //创建滚动域对象
setSize(DEFULT_WIDTH,DEFULT_HEIGHT);
setTitle("带滚动视图的容器");
//将滚动容器放入内容窗格中
getContentPane().add(scrollPane,BorderLayout.CENTER);
setVisible(true);
setResizable(false);
}
}