Java examples for Swing:JFrame
get parent Frame from Component
//package com.java2s; import java.awt.*; public class Main { public static Frame getFrame(Component theComponent) { Component currParent = theComponent; Frame theFrame = null;// w w w.j a v a 2 s .c om while (currParent != null) { if (currParent instanceof Frame) { theFrame = (Frame) currParent; break; } currParent = currParent.getParent(); } return theFrame; } }