?? boxlayout2.java
字號:
import java.awt.*;
import javax.swing.*;
public class BoxLayout2 extends JApplet {
JButton button1 = new JButton("Button 1");
JButton button2 = new JButton("Button 2");
JButton button3 = new JButton("Button 3");
JButton button4 = new JButton("Button 4");
JButton button5 = new JButton("Button 5");
JPanel xP=new JPanel();
JPanel yP=new JPanel();
public void init() {
Container cp = getContentPane();
FlowLayout layout=new FlowLayout();
cp.setLayout(layout);
cp.add(xP);
cp.add(yP);
BoxLayout layout1=new BoxLayout(xP,BoxLayout.X_AXIS);
xP.setLayout(layout1);
xP.add(button1);
xP.add(button2);
xP.add(button3);
BoxLayout layout2=new BoxLayout(yP,BoxLayout.Y_AXIS);
yP.setLayout(layout2);
yP.add(button4);
yP.add(button5);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -