com.scudata.ide.common.swing.JOptionPaneEx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
package com.scudata.ide.common.swing;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.Window;
import javax.swing.JOptionPane;
/**
* Imitate the JOptionPane.getWindowForComponent method
*
*/
public class JOptionPaneEx extends JOptionPane {
private static final long serialVersionUID = 1L;
/**
* ???캯??
*/
public JOptionPaneEx() {
super();
}
/**
* ??ȡ??????
*
* @param parentComponent
* @return
* @throws HeadlessException
*/
public static Window getJWindowForComponent(Component parentComponent)
throws HeadlessException {
if (parentComponent == null)
return getRootFrame();
if (parentComponent instanceof Frame
|| parentComponent instanceof Dialog)
return (Window) parentComponent;
return JOptionPaneEx
.getJWindowForComponent(parentComponent.getParent());
}
}