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 aboutDIalog extends JDialog {
    private JPanel contentPane;
    private JButton buttonOK;
    private JPanel iconPanel;

    public aboutDIalog() {
        setTitle("关于图书管理系统");
        setVisible(false);
        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(buttonOK);
        setResizable(false);
        JLabel iconLabel = new JLabel();
        iconLabel.setIcon(new ImageIcon("src/com/msksbr/images/logo_128.png"));
        iconPanel.add(iconLabel);
        setModal(false);
        setAlwaysOnTop(true);

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

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

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