📄 vbox.java
字号:
// VBox.java// A quick test of the BoxLayout manager using the Box utility class.// This box is laid out vertically.//package jswing.ch11;import java.awt.*;import javax.swing.*;public class VBox extends JFrame { public VBox() { super("Vertical Box Test Frame"); setSize(200, 100); Panel box = new Panel(); // Use BoxLayout.X_AXIS below if you want a horizontal box box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS)); setContentPane(box); for (int i = 0; i < 3; i++) { Button b = new Button("B" + i); box.add(b); } setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public static void main(String args[]) { VBox bt = new VBox(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -