import javax.swing.*;
/**
* @author rice
*
* TODO 要更改此生成的类型注释的模板,请转至 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class Jscroll extends JFrame {
JButton ok;
JTextField text = new JTextField(15);
JPasswordField pwd = new JPasswordField(15);
JTextArea ta = new JTextArea(5, 15);
JLabel username = new JLabel("用户名:");
JLabel password = new JLabel("密 码:");
JLabel area = new JLabel("正 文:");
Jscroll() {
super("提交表单");
this.setSize(250, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel p = new JPanel();
ImageIcon img = new ImageIcon("G://eclipse-work//jswing//imgs//13.gif");
ok = new JButton("确认", img);
//密码符号
pwd.setEchoChar('#');
// 文本域自动换行。
//ta.setLineWrap(true);
JScrollPane scroll = new JScrollPane(ta,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
p.add(username);
p.add(text);
p.add(password);
p.add(pwd);
p.add(area);
p.add(scroll);
p.add(ok);
this.setContentPane(p);
}
public static void main(String[] args) {
Jscroll j = new Jscroll();
j.show();
}
}