Java Utililty Methods JFrame Parent

List of utility methods to do JFrame Parent

Description

The list of methods to do JFrame Parent are organized into topic(s).

Method

JFramegetParentFrame(Component component)
get Parent Frame
Container container = component.getParent();
if (container instanceof JFrame || container == null) {
    return (JFrame) container;
} else {
    return getParentFrame(container);
FramegetParentFrame(Component parent)
get Parent Frame
if (parent instanceof Frame) {
    return (Frame) parent;
Window window = SwingUtilities.windowForComponent(parent);
return (window instanceof Frame ? (Frame) window : null);
JFramegetParentFrame(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;
...
JFramegetParentFrame(Frame[] parentFrames)
Find first instance of a JFrame.
for (Frame frame : parentFrames) {
    if (frame instanceof JFrame) {
        return (JFrame) frame;
return null;
JFramegetParentFrame(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);
JFramegetParentFrame(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;
...
FramegetParentFrame(JComponent comp)
get Parent Frame
Container p = comp;
while (p != null && !(p instanceof Frame)) {
    p = p.getParent();
return p == null ? null : (Frame) p;
FramegetParentFrameForCompomponent(Component comp)
get Parent Frame For Compomponent
Window window = getParentWindowForComponent(comp);
Frame parentFrame = null;
if (window instanceof Frame) {
    parentFrame = (Frame) window;
return parentFrame;
JInternalFramegetParentInternalFrame(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;
FramegetRealFrameParent(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);