📄 testborderlayout.java
字号:
import javax.swing.*;
import java.awt.BorderLayout;
public class TestBorderLayout{
public static void main(String[] ar){
JFrame frame = new JFrame();
JButton button1 = new JButton("button1");
JButton button2 = new JButton("button2");
JButton button3 = new JButton("button3");
JButton button4 = new JButton("button4");
JButton button5 = new JButton("button5");
frame.add(button1,BorderLayout.NORTH);
frame.add(button2,BorderLayout.SOUTH);
frame.add(button3,BorderLayout.WEST);
frame.add(button4,BorderLayout.EAST);
frame.add(button5,BorderLayout.CENTER);
frame.setSize(300,200);
frame.pack();
frame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -