📄 myfirstframe1.java
字号:
import java.awt.*;
import java.awt.event.*; /* Import components, interfaces, and events */
public class MyFirstFrame1 extends Frame
implements ActionListener /* Class of type Frame and ActionListener */
{ private Button quit = new Button("Quit"); /* Define GUI components as fields */
public MyFirstFrame1() /* Constructor to initialize frame */
{ super("Test Window");
add(quit);
pack();
show();
quit.addActionListener(this);
} /* Register button as action event source and tie it to event handler.
Here it is this class itself. */
public void actionPerformed(ActionEvent e) /* Specify what to do with action events */
{ dispose();
System.exit(0); /* Quits program, returns to operating system */
}
public static void main(String args[]) /* Make program executable */
{ MyFirstFrame1 mf = new MyFirstFrame1();}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -