package com.axis.innovators.box.gui;

import com.axis.innovators.box.AxisInnovatorsBox;
import com.axis.innovators.box.register.LanguageManager;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * @author tzdwindows 7
 */
public class WindowsJDialog extends JDialog {
    public static LanguageManager.Language language = LanguageManager.getLoadedLanguages();

    public WindowsJDialog() {}

    public WindowsJDialog(Window owner, String title, Dialog.ModalityType modalityType) {
        super(owner, title, modalityType);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                dispose();
            }
        });
    }

    public WindowsJDialog(Frame owner, String title, boolean modal) {
        super(owner, title, modal);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                dispose();
            }
        });
    }

    public void initUI() {
        language = LanguageManager.getLoadedLanguages();
    }

    public void dispose_() {
        super.dispose();
    }
    @Override
    public void dispose() {
        AxisInnovatorsBox.getMain().clearWindow(this);
        super.dispose();
    }
}
