zoukankan      html  css  js  c++  java
  • LayoutDemo

    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);
        }
    
    }
  • 相关阅读:
    如何判断PHP 是ts还是nts版的
    让IE支持placeholder属性
    解决点击浏览器后退按钮页面过期的问题
    git记住用户名密码
    php保存base64数据
    azure注册码
    SQL Server 2008 R2密钥序列号
    SQL允许远程访问
    PHP生成表格
    PHP发起get post put delete请求
  • 原文地址:https://www.cnblogs.com/softidea/p/4634665.html
Copyright © 2011-2022 走看看