Java examples for Swing:JFrame
find JFrame
//package com.java2s; import java.awt.Component; import javax.swing.JFrame; public class Main { public static JFrame findJFrame(Component myComponent) { Component currentParent = myComponent; JFrame myFrame = null;/*from w w w.j a v a2 s .c o m*/ while (currentParent != null) { if (currentParent instanceof JFrame) { myFrame = (JFrame) currentParent; break; } currentParent = currentParent.getParent(); } return myFrame; } }