Java Code Examples for java.awt.Window#getOwner()
The following examples show how to use
java.awt.Window#getOwner() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RComponent.java From marathonv5 with Apache License 2.0 | 6 votes |
private JSONObject addWindowParents(JSONObject r, Window parent, JSONObject current) { while (parent != null) { if (!parent.getClass().getName().equals("javax.swing.SwingUtilities$SharedOwnerFrame") && !parent.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow") && parent.isVisible()) { JSONObject pWindow = getContextJSONObject(parent); if (r == null) { r = pWindow; } if (current != null) { current.put("container", pWindow); } current = pWindow; } parent = parent.getOwner(); } return r; }
Example 2
Source File: PopupPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Checks if the focus is still on this component or its child components. */ private boolean isFocusInside(Object newFocusedComp) { if (newFocusedComp instanceof Popup) { return true; } if (newFocusedComp instanceof Component && !SwingUtilities.isDescendingFrom((Component) newFocusedComp, this)) { // Check if focus is on other window if (containingWindow == null) { return false; } Window focusedWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); // if focus is on other window in owner chain, return false Window parent = containingWindow; do { if (parent == focusedWindow) { return false; } else { parent = parent.getOwner(); } } while (parent != null); } return true; }
Example 3
Source File: CustomizedToolbar.java From pumpernickel with MIT License | 6 votes |
/** * Are we painting against a dark background? This checks the JVM version, * the os, and whether the window's ultimate parent uses Apple's * brush-metal-look. */ protected static boolean isDarkBackground(Window w) { if (!isMac) return false; while (w != null) { if (w instanceof RootPaneContainer) { JRootPane rootPane = ((RootPaneContainer) w).getRootPane(); Object obj = rootPane .getClientProperty("apple.awt.brushMetalLook"); if (obj == null) obj = Boolean.FALSE; if (obj.toString().equals("true")) { return true; } } w = w.getOwner(); } return false; }
Example 4
Source File: D3DGraphicsDevice.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 5
Source File: D3DGraphicsDevice.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 6
Source File: D3DGraphicsDevice.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 7
Source File: DialogLoggerUtil.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
/** * Center on parent ( absolute true/false (exact center or 25% upper left) ) * * @param child * @param absolute */ public static void centerOnParent(final Window child, final boolean absolute) { child.pack(); boolean useChildsOwner = child.getOwner() != null ? ((child.getOwner() instanceof JFrame) || (child.getOwner() instanceof JDialog)) : false; final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension parentSize = useChildsOwner ? child.getOwner().getSize() : screenSize; final Point parentLocationOnScreen = useChildsOwner ? child.getOwner().getLocationOnScreen() : new Point(0, 0); final Dimension childSize = child.getSize(); childSize.width = Math.min(childSize.width, screenSize.width); childSize.height = Math.min(childSize.height, screenSize.height); child.setSize(childSize); int x; int y; if ((child.getOwner() != null) && child.getOwner().isShowing()) { x = (parentSize.width - childSize.width) / 2; y = (parentSize.height - childSize.height) / 2; x += parentLocationOnScreen.x; y += parentLocationOnScreen.y; } else { x = (screenSize.width - childSize.width) / 2; y = (screenSize.height - childSize.height) / 2; } if (!absolute) { x /= 2; y /= 2; } child.setLocation(x, y); }
Example 8
Source File: D3DGraphicsDevice.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 9
Source File: D3DGraphicsDevice.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 10
Source File: D3DGraphicsDevice.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 11
Source File: D3DGraphicsDevice.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 12
Source File: D3DGraphicsDevice.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 13
Source File: D3DGraphicsDevice.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 14
Source File: D3DGraphicsDevice.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 15
Source File: NbPresenter.java From netbeans with Apache License 2.0 | 5 votes |
/** * @return Focused and showing Window or null. */ private Window findFocusedWindow() { Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); while( null != w && !w.isShowing() ) { w = w.getOwner(); } return w; }
Example 16
Source File: D3DGraphicsDevice.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 17
Source File: D3DGraphicsDevice.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }
Example 18
Source File: D3DGraphicsDevice.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Return the owning Frame for a given Window. Used in setFSWindow below * to set the properties of the owning Frame when a Window goes * into fullscreen mode. */ private Frame getToplevelOwner(Window w) { Window owner = w; while (owner != null) { owner = owner.getOwner(); if (owner instanceof Frame) { return (Frame) owner; } } // could get here if passed Window is an owner-less Dialog return null; }