List of utility methods to do JFrame Parent
JFrame | getParentFrame(Component component) get Parent Frame Container container = component.getParent(); if (container instanceof JFrame || container == null) { return (JFrame) container; } else { return getParentFrame(container); |
Frame | getParentFrame(Component parent) get Parent Frame if (parent instanceof Frame) { return (Frame) parent; Window window = SwingUtilities.windowForComponent(parent); return (window instanceof Frame ? (Frame) window : null); |
JFrame | getParentFrame(Component source) get Parent Frame Container parent; for (parent = source.getParent(); parent != null; parent = parent.getParent()) if (parent instanceof JFrame) break; if (parent == null) return null; else return (JFrame) parent; ... |
JFrame | getParentFrame(Frame[] parentFrames) Find first instance of a JFrame. for (Frame frame : parentFrames) { if (frame instanceof JFrame) { return (JFrame) frame; return null; |
JFrame | getParentFrame(JComponent c) get Parent Frame Container parent = c.getParent(); if (parent == null) return null; else if (parent instanceof JFrame) return (JFrame) parent; else return getParentFrame((JComponent) parent); |
JFrame | getParentFrame(JComponent comp) Finds the parent frame of the component or null if there isn't one Component p = comp.getParent(); while (p != null) { if (p instanceof JFrame) return (JFrame) p; else p = p.getParent(); return null; ... |
Frame | getParentFrame(JComponent comp) get Parent Frame Container p = comp; while (p != null && !(p instanceof Frame)) { p = p.getParent(); return p == null ? null : (Frame) p; |
Frame | getParentFrameForCompomponent(Component comp) get Parent Frame For Compomponent Window window = getParentWindowForComponent(comp); Frame parentFrame = null; if (window instanceof Frame) { parentFrame = (Frame) window; return parentFrame; |
JInternalFrame | getParentInternalFrame(Component comp) Tries to determine the internal frame this component is part of. if (comp instanceof Container) return (JInternalFrame) getParent((Container) comp, JInternalFrame.class); else return null; |
Frame | getRealFrameParent(Component c) get the Frame that surrounds a component. while (!((c instanceof Frame) || (c instanceof JFrame))) { if (c == null) return (null); else c = c.getParent(); return ((Frame) c); |