Java examples for Swing:JComponent
get Ancestor JDialog from Component
//package com.java2s; import java.awt.Component; import javax.swing.JDialog; import javax.swing.SwingUtilities; public class Main { public static JDialog getDialog(Component component) { if (component instanceof JDialog) return (JDialog) component; return (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, component);// w w w . j a va 2s. c o m } }