📄 gluedemo.java
字号:
package chapter6.layout.BoxLayout;
import java.awt.*;
import javax.swing.*;
public class GlueDemo extends JFrame {
public GlueDemo() {
Container contentPane = this.getContentPane();
Box box = new Box(BoxLayout.X_AXIS); //水平方式
contentPane.add(box);
box.add(new JButton("one"));
box.add(Box.createGlue());
box.add(new JButton("two"));
this.setTitle("GlueDemo");
this.setSize(300, 100);
this.setLocation(400, 400);
this.setVisible(true);
}
public static void main(String[] args) {
GlueDemo test = new GlueDemo();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -