List of utility methods to do JComponent Container
Component | getRoot(Component comp) Returns the "root" of the component tree containint comp The root is defined as either the least ancestor of comp which is a Window , or the greatest ancestor of comp which is a Applet if no Window ancestors are found.
Applet app = null; Window win = null; while (comp != null) { if (win == null && comp instanceof Window) win = (Window) comp; else if (comp instanceof Applet) app = (Applet) comp; comp = comp.getParent(); ... |
JDialog | getRoot(JComponent pchildComponent) get Root Container objParent = pchildComponent.getParent(); while (objParent != null) { objParent = objParent.getParent(); if (objParent instanceof JDialog) { return (JDialog) objParent; return null; ... |
Container | getRootContainer(Component c) get Root Container if (c == null) { return null; Container parent = c.getParent(); while ((parent != null) && !(parent instanceof JPopupMenu) && !(parent instanceof JInternalFrame) && !(parent instanceof Window) && (parent.getParent() != null)) { parent = parent.getParent(); return parent; |
Container | getRootContainer(Component c) get Root Container if (c != null) { Container parent = c.getParent(); while ((parent != null) && !(parent instanceof JPopupMenu) && !(parent instanceof JInternalFrame) && !(parent instanceof Window) && (parent.getParent() != null)) { parent = parent.getParent(); return parent; return null; |
Container | getRootContainer(Component c) get Root Container if (c == null) { return null; Container parent = c.getParent(); while ((parent != null) && !(parent instanceof JPopupMenu) && !(parent instanceof JInternalFrame) && !(parent instanceof Window) && (parent.getParent() != null)) { parent = parent.getParent(); return parent; |
Container | getRootContainer(Component c) get Root Container if (c == null) { return null; Container parent = c.getParent(); while ((parent != null) && !(parent instanceof JPopupMenu) && !(parent instanceof JInternalFrame) && !(parent instanceof Window) && (parent.getParent() != null)) { parent = parent.getParent(); return parent; |
JRootPane | getRootPane(Component cmp) Returns the root pane or null. return SwingUtilities.getRootPane(cmp);
|
JRootPane | getRootPane(final Component component) Returns root pane for the specified component or null if it doesn't exist. if (component == null) { return null; } else if (component instanceof JFrame) { return ((JFrame) component).getRootPane(); } else if (component instanceof JDialog) { return ((JDialog) component).getRootPane(); } else if (component instanceof JWindow) { return ((JWindow) component).getRootPane(); ... |
RootPaneContainer | getRootPaneContainer(Component c) get Root Pane Container if (c instanceof RootPaneContainer) { return (RootPaneContainer) c; for (Container p = c.getParent(); p != null; p = p.getParent()) { if (p instanceof RootPaneContainer) { return (RootPaneContainer) p; return null; |
RootPaneContainer | getRootPaneContainer(Component c) Gets the root pane container of a component. for (; c != null; c = c.getParent()) { if (c instanceof RootPaneContainer) { return (RootPaneContainer) c; return null; |