All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.ide.common.swing.JOptionPaneEx Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20240823
Show newest version
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());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy