package com.suwish.pc.ui.component;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.WindowEvent;
import javax.swing.JDialog;
import javax.swing.JPanel;
/**
*
* @author Min
*
*/
public class UIDialog extends JDialog {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane = null;
public UIDialog(Frame frame, String title, boolean mode){
super(frame ,title, mode);
initUI();
}
public UIDialog(Window frame, String title){
super(frame ,title);
initUI();
}
public UIDialog(){
initUI();
}
/**
*
* 覆盖对话框的销毁方法,默认的dispose可能造成线程问题,引起CPU过高
*
*/
public void dispose(){
dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
private void initUI(){
contentPane = new JPanel();
getContentPane().setLayout(new BorderLayout());
getContentPane().add(contentPane, BorderLayout.CENTER);
}
/**
* 替换默认的默认的{@link JDialog#getContentPane()}方法,为了将来统一UI
*
* @return
*/
public JPanel getIContentPane(){
return contentPane;
}
public UIDialog getInstance(){
return this;
}
}