demoboxlayout.java
来自「基于netbeans的java桌面应用程序合集」· Java 代码 · 共 45 行
JAVA
45 行
/*
* DemoBoxLayout.java
*
* Created on 2007年8月1日, 下午2:40
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.Adam;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author Administrator
*/
public class DemoBoxLayout extends JFrame{
JButton jButtonOne,jButtonTwo,jButtonThree,jButtonFour,jButtonFive;
/** Creates a new instance of DemoBoxLayout */
public DemoBoxLayout() {
Container con=this.getContentPane();
con.setLayout(new BoxLayout(con,BoxLayout.Y_AXIS));
jButtonOne=new JButton("按钮1");
jButtonTwo=new JButton("按钮2");
jButtonThree=new JButton("特殊按钮3");
jButtonFour=new JButton("按钮4");
jButtonFive=new JButton("更大的按钮5");
con.add(jButtonOne);
con.add(jButtonTwo);
con.add(jButtonThree);
con.add(jButtonFour);
con.add(jButtonFive);
this.setTitle("BoxLayout示例");
this.setBounds(100,100,300,200);
this.setVisible(true);
this.validate();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
DemoBoxLayout dblayout=new DemoBoxLayout();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?