twoframes.java
来自「里面包含了多个java的编程示例!而且举出初学者常常遇到的错误!」· Java 代码 · 共 26 行
JAVA
26 行
import javax.swing.*;
public class TwoFrames extends JFrame {
public TwoFrames() {
super("First Frame");
setSize(350, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SecondFrame two = new SecondFrame();
setVisible(true);
two.setVisible(true);
}
public static void main(String[] arguments) {
TwoFrames tf = new TwoFrames();
}
}
class SecondFrame extends JFrame {
SecondFrame() {
super("Second Frame");
setSize(150, 80);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?