package com.msksbr.images;

import com.msksbr.LoginFrm.ScreenSize;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class EasterEgg extends JDialog {
    private JPanel contentPane;
    private JButton buttonOK;
    private JLabel imageLable;

    public EasterEgg() {
        setTitle("Easter Egg!");
        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(buttonOK);
        imageLable.setIcon(new ImageIcon("src/com/msksbr/images/BuzzBeans.png"));

        buttonOK.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                onOK();
            }
        });

        pack();
        setResizable(false);
        setLocation();
        setVisible(true);
    }

    private void onOK() {
        // 在此处添加您的代码
        dispose();
    }

    public void setLocation() {
        setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
    }
}
