herodialog.java

来自「windows自带的扫雷游戏」· Java 代码 · 共 84 行

JAVA
84
字号
package mine.view;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import mine.*;
public class HeroDialog
    extends JDialog {
    JPanel panel1 = new JPanel();
    JTextArea jTextArea1 = new JTextArea();
    JButton ReRecoder = new JButton();
    JButton confirm = new JButton();
    GameConfigure gameconfigure = GameConfigure.getInstance();

    public HeroDialog(Frame frame) {
        super(frame, "扫雷英雄榜", true);
        init();
        this.setSize(250, 150);
        this.setBounds((int)frame.getX() + 20,
                       (int) frame.getY() + 75, 250, 150);
    }

    public HeroDialog() {

    }

    private void init() {
        panel1.setLayout(null);
        jTextArea1.setBackground(UIManager.getColor("CheckBox.background"));
        jTextArea1.setText(gameconfigure.getRecorderShow());
        jTextArea1.setEditable(false);
        jTextArea1.setBounds(new Rectangle(13, 12, 238, 59));
        ReRecoder.setBounds(new Rectangle(17, 75, 93, 22));
        ReRecoder.setActionCommand("jButton1");
        ReRecoder.setText("重新计分");
        ReRecoder.addActionListener(new HeroDialog_ReRecoder_actionAdapter(this));
        confirm.setText("确定");
        confirm.addActionListener(new HeroDialog_confirm_actionAdapter(this));
        confirm.setActionCommand("jButton1");
        confirm.setBounds(new Rectangle(121, 74, 88, 23));
        getContentPane().add(panel1);
        panel1.add(jTextArea1, null);
        panel1.add(ReRecoder, null);
        panel1.add(confirm, null);
    }

    void confirm_actionPerformed(ActionEvent e) {
        this.dispose();
    }

    void ReRecoder_actionPerformed(ActionEvent e) {
        gameconfigure.reRecorder();
        init();
    }
}


class HeroDialog_confirm_actionAdapter
    implements java.awt.event.ActionListener {
    HeroDialog adaptee;

    HeroDialog_confirm_actionAdapter(HeroDialog adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.confirm_actionPerformed(e);
    }
}


class HeroDialog_ReRecoder_actionAdapter
    implements java.awt.event.ActionListener {
    HeroDialog adaptee;

    HeroDialog_ReRecoder_actionAdapter(HeroDialog adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.ReRecoder_actionPerformed(e);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?