package com.msksbr.MainFrm.MenuItemDiaog;

import com.msksbr.LoginFrm.ScreenSize;

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

public class showMessae extends JDialog {
    private JPanel contentPane;
    private JButton buttonOK;
    private JTextPane textPane1;

    public showMessae(String message, String title) {
        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(buttonOK);

        buttonOK.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                onOK();
            }
        });
        this.textPane1.setText(message);
        this.setTitle(title);
        textPane1.setEditable(false);
        pack();
        setResizable(false);
        setCenterLocation();
        setVisible(true);
    }

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

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