一段带有边框说明的代码
2013-10-08 20:55
190 查看
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Jt{
public static void main(String[] args){
JFrame f=new JFrame( "JTextArea2 ");
f.setVisible(true);
f.setSize(600,400);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane=f.getContentPane();
contentPane.setLayout(new BorderLayout());
JPanel p1=new JPanel();
p1.setLayout(new GridLayout(1,1));
p1.setBorder(BorderFactory.createTitledBorder( "构造TextArea-使用GridLayout,加ScrollBar "));
JTextArea t1=new JTextArea(5,25);
t1.setTabSize(10);
t1.setFont(new Font( "标楷体 ",Font.BOLD,16));
t1.setLineWrap(true);//激活自动换行功能
t1.setWrapStyleWord(true);//激活断行不断字功能
p1.add(new JScrollPane(t1));//将JTextArea放入JScrollPane中
//这样就能利用滚动的效果看到输入超过JTextArea高度的文字.
contentPane.add(p1);
}
}
import java.awt.event.*;
import javax.swing.*;
public class Jt{
public static void main(String[] args){
JFrame f=new JFrame( "JTextArea2 ");
f.setVisible(true);
f.setSize(600,400);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane=f.getContentPane();
contentPane.setLayout(new BorderLayout());
JPanel p1=new JPanel();
p1.setLayout(new GridLayout(1,1));
p1.setBorder(BorderFactory.createTitledBorder( "构造TextArea-使用GridLayout,加ScrollBar "));
JTextArea t1=new JTextArea(5,25);
t1.setTabSize(10);
t1.setFont(new Font( "标楷体 ",Font.BOLD,16));
t1.setLineWrap(true);//激活自动换行功能
t1.setWrapStyleWord(true);//激活断行不断字功能
p1.add(new JScrollPane(t1));//将JTextArea放入JScrollPane中
//这样就能利用滚动的效果看到输入超过JTextArea高度的文字.
contentPane.add(p1);
}
}
相关文章推荐
- 一段代码说明javascript闭包运行机制
- JavaScript 带有参数并返回值【每日一段代码54】
- 一段代码说明LEFT JOIN 和INNER JOIN
- 一段代码说明javascript闭包执行机制
- IOS中如何绘制带有边框的button的按钮,附代码;
- 一段代码既说明printf的入栈顺序是从右想做的,又说明inet_ntoa返回值是放在一个静态区域的,连续执行会覆盖
- 通过一段代码说明C#中rel与out的使用区别
- 纯CSS圆角边框的一段代码
- javaScript函数的闭包的一个运用 一段魔法代码来说明
- 一段代码清晰说明js中的this
- 纯CSS圆角边框的一段代码
- c#继承规则(一段代码说明)
- 通过一段代码说明C#中rel与out的使用区别
- 一段汇编小程序及说明——将数据,代码,栈放入不同的段
- CSS实现鼠标滑过文字弹出一段说明文字无JS代码
- main 主函数执行完毕后,是否可能会再执行一段代码,给出说明?
- http ftp错误代码说明
- jsp多页面使用同一段html jsp代码方法 多页面包含同一段html代码
- visualsvn代码管理工具使用说明