zoukankan      html  css  js  c++  java
  • 用NULL布局为什么不能显示

    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;

    class WinBox extends JFrame{
        JLabel xm,xb,zy;
        JTextField tf1,tf2;
        JComboBox jbox;
        public WinBox(){
        init();
        setLayout(null);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
        void init(){
            xm=new JLabel("姓名:");
            add(xm);
            setBounds(30, 30, 38,30 );
            
            xb=new JLabel("性别:");
            add(xb);
            setBounds(30, 70, 38, 30);
            
            zy=new JLabel("职业:");
            add(zy);
            setBounds(30, 110, 38, 30);
            
            tf1=new JTextField(30);
            add(tf1);
            setBounds(88, 30, 38, 30);
            
            jbox=new JComboBox();
            jbox.addItem("男");
            jbox.addItem("女");
            add(jbox);
            setBounds(88, 70, 38, 30);
            
            tf2=new JTextField(30);
            add(tf2);
            setBounds(88, 110, 38, 30);
            
        }
        
    }
    public class NullLayoutDemo {

        public static void main(String[] args) {
            // TODO Auto-generated method stub
         WinBox win=new WinBox();
         win.setBounds(100,100,380,280);
         win.setTitle("盒式嵌套布局");
        }

    }

    在线跪求啊!!!

  • 相关阅读:
    网址
    123
    工具安装
    博客专栏-计算机网络
    JQuery(1)
    HTML常用标签
    Spring的线程池技术:ThreadPoolTaskExecutor
    Error:java: 程序包lombok不存在- IDEA+maven+lombok
    Andriod Studio中新创建的xml布局文件无法在R.layout中调用
    SAST : Single-Shot Arbitrarily-Shaped Text Detector论文阅读笔记
  • 原文地址:https://www.cnblogs.com/creazybeauty/p/5846950.html
Copyright © 2011-2022 走看看