jpanelboxtest.java
来自「Java程序设计技巧与开发实例附书源代码。」· Java 代码 · 共 32 行
JAVA
32 行
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.*;
public class JPanelBoxTest
extends JFrame {
private JButton titledButton = new JButton("Button with a Title");
private JButton quit = new JButton("Quit");
private JButton test = new JButton("Test");
public JPanelBoxTest() {
super("JPanelBox Test");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanelBox buttons = new JPanelBox(new FlowLayout(), "Action");
buttons.add(quit);
buttons.add(test);
getContentPane().setLayout(new GridLayout(2, 1));
getContentPane().add(new JPanelBox(titledButton, "A Title"));
getContentPane().add(buttons);
validate();
pack();
setVisible(true);
}
public static void main(String args[]) {
JPanelBoxTest jpbt = new JPanelBoxTest();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?