JFrame () { final Frame[] all = Frame.getFrames(); for (Frame each : all) { if (each instanceof IdeFrameImpl) { return (JFrame)each; } } throw new IllegalStateException("Cannot find IdeFrame to run on"); }