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

📄 dialog.java

📁 JAVA编写的俄罗斯方块游戏
💻 JAVA
字号:
package MiniGame;

import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class Dialog extends JDialog {
     public  JTextField jLabel_name = new JTextField();

    public Dialog() {
        try {

            setSize(300,400);
            setLocation(500,300);
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        jLabel1.setFont(new java.awt.Font("Bell MT", Font.BOLD, 20));
        jLabel1.setForeground(Color.red);
        jLabel1.setText("Your Name");
        this.getContentPane().setLayout(gridBagLayout1);
        jB_OK.setText("OK");
        jB_OK.addActionListener(new Dialog_jB_OK_actionAdapter(this));
        jLabel2.setForeground(Color.magenta);
        jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel2.setText("top 10");
        jB_cancel.setText("Cancel");
        this.getContentPane().add(jLabel1,
                                  new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
                , GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(28, 0, 0, 0), 13, 4));
        this.getContentPane().add(jLabel_name,
                                  new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
                , GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(28, 12, 0, 62), 96, 3));
        this.getContentPane().add(jLabel2,
                                  new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0
                , GridBagConstraints.CENTER, GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0), 249, 2));
        this.getContentPane().add(jTextArea_top_ten,
                                  new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
                , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                new Insets(4, 47, 4, 44), 293, 196));
        this.getContentPane().add(jB_OK,
                                  new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
                , GridBagConstraints.CENTER, GridBagConstraints.NONE,
                new Insets(15, 41, 18, 27), 18, 4));
        this.getContentPane().add(jB_cancel,
                                  new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
                , GridBagConstraints.CENTER, GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0), 0, 0));
    }

    JLabel jLabel1 = new JLabel();

    JTextArea jTextArea_top_ten = new JTextArea();
    JButton jB_OK = new JButton();
    GridBagLayout gridBagLayout1 = new GridBagLayout();
    JLabel jLabel2 = new JLabel();
    JButton jB_cancel = new JButton();
    public void jB_OK_actionPerformed(ActionEvent e) {
       GameApp.frame.gamePanel.changetop();
        this.setVisible(false);
    }
}


class Dialog_jB_OK_actionAdapter implements ActionListener {
    private Dialog adaptee;
    Dialog_jB_OK_actionAdapter(Dialog adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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