📄 swingcompdemo.java
字号:
import javax.swing.*;
import java.awt.*;
public class SwingCompDemo{
public static void main(String[] args){
SwingFrame frame=new SwingFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
class SwingFrame extends JFrame{
public static final int WIDTH=300;
public static final int HEIGHT=150;
public SwingFrame(){
setTitle("SwingCompDemo");
setSize(WIDTH,HEIGHT);
JPanel panel=new JPanel();
Container c=getContentPane();
JButton ok = new JButton("确定");
panel.add(ok);
JButton cancel = new JButton("取消");
panel.add(cancel);
c.add(panel,BorderLayout.SOUTH);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -