📄 button6.java
字号:
import java.awt.*;
import javax.swing.*;
public class button6 extends JFrame{
JPanel p1,p2;
JButton b11,b12,b13,b21,b22,b23;
Container cp =null;
public button6(){
this("No Title");;
}
public button6(String title){
super(title);
p1 = new JPanel();
p2 = new JPanel();
p1.setLayout(new FlowLayout());
p2.setLayout(new FlowLayout());
b11 = new JButton("Button 1");
b12 = new JButton("Button 2");
b13 = new JButton("Button 3");
b21 = new JButton("Button 4");
b22 = new JButton("Button 5");
b23 = new JButton("Button 6");
cp = getContentPane();
cp.setLayout(new FlowLayout());
p1.add(b11);p1.add(b12);p1.add(b13);
p2.add(b21);p2.add(b22);p2.add(b23);
cp.add(p1);cp.add(p2);
setSize(400,240);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]){
new button6("GUI Demo");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -