⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demoboxlayouttwo.java

📁 基于netbeans的java桌面应用程序合集
💻 JAVA
字号:
/*
 * DemoBoxLayoutTwo.java
 *
 * Created on 2007年8月1日, 下午4:15
 *
 * 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 DemoBoxLayoutTwo extends JFrame{
    JButton jButtonOne,jButtonTwo,jButtonThree,jButtonFour,jButtonFive;
    /** Creates a new instance of DemoBoxLayoutTwo */
    public DemoBoxLayoutTwo() {
        Container con=this.getContentPane();
        con.setLayout(new BoxLayout(con,BoxLayout.X_AXIS));
        jButtonOne=new JButton("按钮1");
        jButtonTwo=new JButton("按钮2");
        jButtonThree=new JButton("特殊按钮3");
        jButtonThree.setAlignmentX(Component.RIGHT_ALIGNMENT);
        jButtonFour=new JButton("按钮4");
        jButtonFive=new JButton("更大的按钮5");
        con.add(jButtonOne);
        con.add(Box.createGlue());
        con.add(jButtonTwo);
        con.add(Box.createHorizontalStrut(40));
        con.add(jButtonThree);
        con.add(Box.createRigidArea(new Dimension(20,30)));
        con.add(jButtonFour);
        con.add(jButtonFive);
        this.setTitle("BoxLayout示例");
        this.setBounds(100,100,500,200);
        this.setVisible(true);
        this.validate();
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
    }
     public static void main(String[] args) {
        DemoBoxLayoutTwo dblayout=new DemoBoxLayoutTwo();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -