TextField 组件 只能创建 单行文本
复制代码
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
27package frame; import java.awt.event.*; import java.awt.*; class WindowText extends Frame{ TextField text1,text2; Button button; WindowText(String str){ super(str); setLayout(new FlowLayout()); text1 = new TextField("请输入密码:",10); text1.setEditable(false); text2 = new TextField(10); text2.setEchoChar('*'); button = new Button("确定"); add(text1); add(text2); add(button); setBounds(100,100,200,150); setVisible(true); validate(); } } public class Fra{ public static void main(String args[]){ WindowText win = new WindowText("添加了文本框的矿口"); } }
最后
以上就是满意树叶最近收集整理的关于Java学习笔记(AWT组件 之 单行文本框)的全部内容,更多相关Java学习笔记(AWT组件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复