⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enddialog.java

📁 Java 开发的弹跳球小游戏代码. 便于理解OO的概念.
💻 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 + -