📄 enddialog.java
字号:
import java.awt.*;import java.awt.event.*;/** * Dialog box when player finishes game. * (Could enter name of winning player, if highest score, etc.) */public class EndDialog extends Dialog { public String choice = "DONE"; private Button done; private Button newGame; public EndDialog (Frame frm, boolean modal, int scoreVal, int bonusVal) { super(frm, modal); // Crude layout - not portable! setLayout(new FlowLayout()); setSize(160, 150); setFont(new Font("Fixed", Font.BOLD, 12)); add(new Label("YOUR SCORE")); add(new Label("Game score: ")); add(new Label("" + scoreVal)); add(new Label("Bonus score: ")); add(new Label("" + bonusVal)); add(new Label("Total score: ")); add(new Label("" + (scoreVal + bonusVal))); done = new Button("Done"); add(done); done.addActionListener(new ActionListener () { public void actionPerformed (ActionEvent e) { choice = "DONE"; dispose(); }}); newGame = new Button("New Game"); add(newGame); newGame.addActionListener(new ActionListener () { public void actionPerformed (ActionEvent e) { choice = "RESTART"; dispose(); }}); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -