hbox.java

来自「java swing 开发代码」· Java 代码 · 共 31 行

JAVA
31
字号
// HBox.java// A quick test of the BoxLayout manager using the Box utility class.//package	jswing.ch11;import java.awt.*;import javax.swing.*;public class HBox extends JFrame {  public HBox() {    super("Horizontal Box Test Frame");    setSize(200, 100);    Panel box = new Panel();    // Use BoxLayout.Y_AXIS below if you want a vertical box    box.setLayout(new BoxLayout(box, BoxLayout.X_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[]) {    HBox bt = new HBox();  }}

⌨️ 快捷键说明

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