Java Swing界面编程(18)---单行文本输入组件:JTextField
2014-05-29 20:05
633 查看
以下的程序与上一例有一点区别,仔细对比不难发现其中的不同之处。
程序截图:
package com.beyole.util; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class test17 { public static void main(String[] args) { JFrame frame = new JFrame("Crystal"); JTextField nameField = new JTextField(30); JTextField location = new JTextField("beyole", 10); JLabel name = new JLabel("输入姓名"); JLabel locat = new JLabel("所属单位"); location.setEnabled(false); name.setBounds(10, 10, 100, 20); locat.setBounds(10, 40, 100, 20); nameField.setBounds(80, 10, 90, 20); location.setBounds(80, 40, 50, 20); frame.setLayout(null); frame.add(locat); frame.add(name); frame.add(location); frame.add(nameField); frame.setSize(300, 100); frame.setLocation(300, 200); frame.setVisible(true); } }
程序截图:
相关文章推荐
- Java Swing界面编程(17)---单行文本输入组件:JTextField
- Java Swing界面编程(20)---多行文本输入组件:JTextArea
- Java AWT组件开发和Swing界面编程
- java基本输入输出编程:文本界面的输入与输出
- Java Swing界面编程(2)---标签组件(JLabel)
- Java Swing界面编程(3)---标签组件(JLabel)
- JavaSwing图形界面编程之消息提示框(一)
- JavaSwing图形界面编程之JMenuBar
- JavaSwing图形界面编程之JApplet(四)
- JavaSwing图形界面编程之JFileChooser(一)
- JavaSwing图形界面编程之对话框(一)
- JavaSwing图形界面编程之Line(一)
- (总结)Swing组件的使用---文本框(JTextField)与文本区(JTextArea)
- java Swing JTextField 限制输入字符(复制粘贴也有效)
- JavaSwing图形界面编程之JSlider(一)
- JavaSwing图形界面编程之登陆校验码(一)
- JavaSwing图形界面编程之Image(一)
- JavaSwing图形界面编程(一)
- JavaSwing图形界面编程之JScrollBar(一)
- 当java swing界面启动无法正常显示,当调整JFrame大小后才能全部显示子组件