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

📄 boxlayoutdemo.java

📁 主要是java书上的一些代码
💻 JAVA
字号:
//: BoxLayoutDemo.java//package g3ds.joop.ch9;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class BoxLayoutDemo extends JFrame{	private Container c;	private JButton button;			public BoxLayoutDemo(){        super("BoxLayoutDemo");                c = getContentPane();        //设置为BoxLayout,沿Y轴向排列        c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));        button = new JButton("Button 1");        //组件采用居中对齐方式        button.setAlignmentX(Component.CENTER_ALIGNMENT);        c.add(button);                button = new JButton("Button 2");        button.setAlignmentX(Component.CENTER_ALIGNMENT);        c.add(button);                button = new JButton("Button 3");        button.setAlignmentX(Component.CENTER_ALIGNMENT);        c.add(button);    }		public static void main(String[] args) {        BoxLayoutDemo frame = new BoxLayoutDemo();                frame.pack();        frame.setVisible(true);        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    }}

⌨️ 快捷键说明

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