java 实现层布局Demo.rar

时间:2023-05-22 01:28:37
【文件属性】:

文件名称:java 实现层布局Demo.rar

文件大小:4KB

文件格式:RAR

更新时间:2023-05-22 01:28:37

java

主要代码: this.setTitle("层级关系Demo"); this.setSize(800, 600); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container container = getContentPane(); container.setLayout(null); actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changeLayer(); } }; layeredPane = new JLayeredPane(); layeredPane.setBounds(10, 10, 700, 500); btn1 = new JButton("按钮一"); btn1.setBounds(10, 10, 100, 30); layeredPane.add(btn1, new Integer(1), 1); btn2 = new JButton("按钮二"); btn2.setBounds(20, 20, 100, 30); layeredPane.add(btn2, new Integer(2), 1); btn3 = new JButton("按钮三"); btn3.setBounds(30, 30, 100, 30); layeredPane.add(btn3, new Integer(3), 1); JButton btn = new JButton("改一下"); btn.setBounds(200, 10, 100, 30); btn.addActionListener(actionListener); layeredPane.add(btn); container.add(layeredPane); this.setVisible(true);


【文件预览】:
Demo_test
----src()
--------MainClass.java(102B)
--------MainFrame.java(2KB)
----bin()
--------MainFrame$1.class(616B)
--------MainFrame.class(3KB)
--------MainClass.class(400B)
----.classpath(301B)
----.settings()
--------org.eclipse.jdt.core.prefs(598B)
----.project(385B)

网友评论