SwingUtilities: getWindowAncestor(Component c) : SwingUtilities « javax.swing « Java by API






SwingUtilities: getWindowAncestor(Component c)

  

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Main {
  public static void main(String[] a) {
    JPanel panel = new JPanel();

    JDialog dialog = new JDialog((JFrame) SwingUtilities.getWindowAncestor(panel), true);
  }

}

   
    
  








Related examples in the same category

1.SwingUtilities: convertPointFromScreen(Point p, Component c)
2.SwingUtilities: convertPointToScreen(Point p, Component c)
3.SwingUtilities: getRoot(Component c)
4.SwingUtilities.invokeLater(Runnable doRun)
5.SwingUtilities.isEventDispatchThread()
6.SwingUtilities.isLeftMouseButton(MouseEvent mouseEvent)
7.SwingUtilities.isMiddleMouseButton(MouseEvent mouseEvent)
8.SwingUtilities.isRightMouseButton(MouseEvent mouseEvent)
9.SwingUtilities: invokeAndWait(Runnable run)
10.SwingUtilities: updateComponentTreeUI(Component c)