LayoutDemo
2015-07-10 01:30
387 查看
package swing.ui; import java.awt.BorderLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; /*2015-7-10*/ public class PanelLayoutTest extends JFrame { private static final long serialVersionUID = -2298874328963807208L; private JTextField name = new JTextField(), id = new JTextField(); private JTextArea content = new JTextArea(); public PanelLayoutTest() { this.setTitle("LayoutTest"); this.setSize(600, 300); JPanel northPanel = new JPanel(); northPanel.setLayout(new GridLayout(2, 2)); northPanel.add(new JLabel("ID:")); northPanel.add(name); northPanel.add(new JLabel("Name:")); northPanel.add(id); this.add(northPanel, BorderLayout.NORTH); this.add(new JScrollPane(content), BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.add(new JButton("Start")); this.add(southPanel, BorderLayout.SOUTH); } public static void main(String[] args) { PanelLayoutTest frame = new PanelLayoutTest(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLocationRelativeTo(null); } }
相关文章推荐
- hdu1710-Binary Tree Traversals (由二叉树的先序序列和中序序列求后序序列)
- 15_Android中任务栈
- 15_Android中任务栈
- 如何利用时间差让cache目录下的文件自动清除
- 未命名 2
- Ubuntu14.04修改/禁用Grub2等待时间
- Java中交换两个int类型变量的方法汇总
- Serializable Clonable
- hdu3999-The order of a Tree (二叉树的先序遍历)
- iOS开发之控件ContentMode代码改变填充模式小结
- 【PCL】非常用类整理
- WCF学习笔记(基于REST规则方式)
- Access 2003数据库规格以及空数据库的.mdb文件很大的情况
- IOS多线程基本使用
- 看opengl写代码(2) Hello,OpenGl
- 10004--Spring 中的 Bean 配置--IOC 和 DI
- 博客管理系统完善日志之一
- PHP截取字符串完美版,不用担心中文截取乱码
- 记中兴软件园一个月实训(一)
- vagrant 资源收集