flowtest.java
来自「< ProJavaProgrammingSecondEdition>」· Java 代码 · 共 24 行
JAVA
24 行
import java.awt.*;
import javax.swing.*;
public class FlowTest extends JFrame {
public static void main(String[] args) {
FlowTest ft = new FlowTest();
ft.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ft.setSize(400, 300);
ft.setVisible(true);
}
public FlowTest() {
super();
Container pane = getContentPane();
pane.setLayout(new FlowLayout(FlowLayout.LEFT));
pane.add(new JLabel("This is a test"));
pane.add(new JButton("of a FlowLayout"));
pane.add(new JTextField(30));
pane.add(new JTextArea("This is a JTextArea", 3, 10));
pane.add(new JLabel("This is a FlowLayout test with a long string"));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?