📄 newdialog.java
字号:
import java.awt.*;import java.awt.event.*;/** * Dialog box asking for new game. */public class NewDialog extends Dialog { public String choice = "No"; private Button yes, no; public NewDialog (Frame frm, boolean modal) { super(frm, modal); setLayout(new FlowLayout()); // setSize(160, 100); // Omitted for cross-platform success add(new Label("Start a new game?")); yes = new Button("Yes"); add(yes); yes.addActionListener(new ActionListener () { public void actionPerformed (ActionEvent e) { choice = "Yes"; dispose(); }}); no = new Button("No"); add(no); no.addActionListener(new ActionListener () { public void actionPerformed (ActionEvent e) { choice = "No"; dispose(); }}); pack(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -