Java tutorial
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static Frame getFrame(Component theComponent) { Component currParent = theComponent; Frame theFrame = null; while (currParent != null) { if (currParent instanceof Frame) { theFrame = (Frame) currParent; break; } currParent = currParent.getParent(); } return theFrame; } }