javax.swing.RootPaneContainer Java Examples
The following examples show how to use
javax.swing.RootPaneContainer.
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: FlatInspector.java From FlatLaf with Apache License 2.0 | 6 votes |
/** * Installs a key listener into the application that allows enabling and disabling * the UI inspector with the given keystroke (e.g. "ctrl shift alt X"). */ public static void install( String activationKeys ) { KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys ); Toolkit.getDefaultToolkit().addAWTEventListener( e -> { if( e.getID() == KeyEvent.KEY_RELEASED && ((KeyEvent)e).getKeyCode() == keyStroke.getKeyCode() && (((KeyEvent)e).getModifiersEx() & KEY_MODIFIERS_MASK) == (keyStroke.getModifiers() & KEY_MODIFIERS_MASK) ) { Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if( activeWindow instanceof RootPaneContainer ) { JRootPane rootPane = ((RootPaneContainer)activeWindow).getRootPane(); FlatInspector inspector = (FlatInspector) rootPane.getClientProperty( FlatInspector.class ); if( inspector == null ) { inspector = new FlatInspector( rootPane ); rootPane.putClientProperty( FlatInspector.class, inspector ); inspector.setEnabled( true ); } else { inspector.uninstall(); rootPane.putClientProperty( FlatInspector.class, null ); } } } }, AWTEvent.KEY_EVENT_MASK ); }
Example #2
Source File: TitlePaneMaximizeButtonWindowMaximizedState.java From seaglass with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public boolean isInState(JComponent c) { Component parent = c; while (parent.getParent() != null) { if (parent instanceof RootPaneContainer) { break; } parent = parent.getParent(); } if (parent instanceof JFrame) { return (((JFrame) parent).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0; } else if (parent instanceof JInternalFrame) { return ((JInternalFrame) parent).isMaximum(); } return false; }
Example #3
Source File: BlockingAction.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public final void run() { try { exectute(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { afterComplete(); } }); } catch(Exception err) { err.printStackTrace(); } finally { t.stop(); RootPaneContainer r = (RootPaneContainer)ResourceEditorApp.getApplication().getMainFrame(); r.setGlassPane(glassPane); } }
Example #4
Source File: ZOrderManager.java From netbeans with Apache License 2.0 | 6 votes |
/** Stops to track given window (RootPaneContainer). */ public boolean detachWindow (RootPaneContainer rpc) { logger.entering(getClass().getName(), "detachWindow"); if (!(rpc instanceof Window)) { throw new IllegalArgumentException("Argument must be subclas of java.awt.Window: " + rpc); //NOI18N } WeakReference<RootPaneContainer> ww = getWeak(rpc); if (ww == null) { return false; } ((Window)rpc).removeWindowListener(this); return zOrder.remove(ww); }
Example #5
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 #6
Source File: BBoxDBGui.java From bboxdb with Apache License 2.0 | 6 votes |
/** * Get the glass pane of the main panel * @return */ public Component getGlassPane() { if(mainPanel == null) { return null; } final RootPaneContainer root = (RootPaneContainer) mainPanel.getTopLevelAncestor(); if(root == null) { return null; } return root.getGlassPane(); }
Example #7
Source File: FullScreenHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #8
Source File: JDialog741.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void start() { System.setProperty("jbre.popupwindow.settype", "true"); jFrame = new JFrame("Wrong popup z-order"); jFrame.setSize(200, 200); jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel jPanel = new JPanel(); jPanel.setPreferredSize(new Dimension(200, 200)); Popup popup = PopupFactory.getSharedInstance().getPopup(jFrame, jPanel, 100, 100); windowAncestor = SwingUtilities.getWindowAncestor(jPanel); ((RootPaneContainer) windowAncestor).getRootPane().putClientProperty("SIMPLE_WINDOW", true); windowAncestor.setFocusable(true); windowAncestor.setFocusableWindowState(true); windowAncestor.setAutoRequestFocus(true); jFrame.setVisible(true); popup.show(); modalBlocker = new JDialog(windowAncestor, "Modal Blocker"); modalBlocker.setModal(true); modalBlocker.setSize(new Dimension(200, 200)); modalBlocker.setLocation(200, 200); modalBlocker.addWindowListener(new JDialog741Listener()); modalBlocker.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); modalBlocker.setVisible(true); }
Example #9
Source File: FullScreenHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static void handleFullScreenEventFromNative(final Window window, final int type) { if (!(window instanceof RootPaneContainer)) return; // handles null SunToolkit.executeOnEventHandlerThread(window, new Runnable() { public void run() { final FullScreenHandler handler = getHandlerFor((RootPaneContainer)window); if (handler != null) handler.notifyListener(new FullScreenEvent(window), type); } }); }
Example #10
Source File: FullScreenHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #11
Source File: FullScreenHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #12
Source File: ZOrderManager.java From netbeans with Apache License 2.0 | 5 votes |
public void clear () { RootPaneContainer rpc; for (WeakReference<RootPaneContainer> elem : zOrder) { rpc = elem.get(); if (rpc != null) { ((Window)rpc).removeWindowListener(this); } } zOrder.clear(); }
Example #13
Source File: ProxyFactoryTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test @Ignore("Not implemented yet, see http://jira.springframework.org/browse/SPR-5708") public void testExclusionOfNonPublicInterfaces() { JFrame frame = new JFrame(); ProxyFactory proxyFactory = new ProxyFactory(frame); Object proxy = proxyFactory.getProxy(); assertTrue(proxy instanceof RootPaneContainer); assertTrue(proxy instanceof Accessible); }
Example #14
Source File: ZOrderManager.java From netbeans with Apache License 2.0 | 5 votes |
private WeakReference<RootPaneContainer> getWeak (RootPaneContainer rpc) { for (WeakReference<RootPaneContainer> elem : zOrder) { if (elem.get() == rpc) { return elem; } } return null; }
Example #15
Source File: ZOrderManager.java From netbeans with Apache License 2.0 | 5 votes |
private WeakReference<RootPaneContainer> getExcludedWeak (RootPaneContainer rpc) { for (WeakReference<RootPaneContainer> elem : excludeSet) { if (elem.get() == rpc) { return elem; } } return null; }
Example #16
Source File: JDialog705.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { SwingUtilities.invokeAndWait(() -> { jFrame = new JFrame("Wrong popup z-order"); jFrame.setSize(200, 200); JPanel jPanel = new JPanel(); jPanel.setPreferredSize(new Dimension(200, 200)); jPanel.setBackground(Color.BLACK); Popup popup = PopupFactory.getSharedInstance().getPopup(jFrame, jPanel, 100, 100); windowAncestor = SwingUtilities.getWindowAncestor(jPanel); ((RootPaneContainer) windowAncestor).getRootPane().putClientProperty("SIMPLE_WINDOW", true); windowAncestor.setFocusable(true); windowAncestor.setFocusableWindowState(true); windowAncestor.setAutoRequestFocus(true); jFrame.setVisible(true); popup.show(); modalBlocker = new JDialog(windowAncestor, "Modal Blocker"); modalBlocker.setModal(true); modalBlocker.setSize(new Dimension(200, 200)); modalBlocker.setLocation(200, 200); modalBlocker.addWindowListener(new DialogListener()); modalBlocker.setVisible(true); }); }
Example #17
Source File: Util.java From drmips with GNU General Public License v3.0 | 5 votes |
/** * Configures the given window to be closed when the Escape button is pressed. * @param <W> A window (JFrame, JDialog, etc.). * @param window Window to configure. */ public static <W extends Window & RootPaneContainer> void enableCloseWindowWithEscape(final W window) { Action closeAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING)); } }; window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close"); window.getRootPane().getActionMap().put("close", closeAction); }
Example #18
Source File: FullScreenHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #19
Source File: CursorControlUtilities.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
public static void stopWaitCursor(JComponent component) { RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor()); root.getGlassPane().setCursor(DEFAULT_CURSOR); root.getGlassPane().removeMouseListener(CLICK_CONSUMER); root.getGlassPane().setVisible(false); root.getRootPane().validate(); }
Example #20
Source File: FullScreenHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #21
Source File: CursorControlUtilities.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
public static void stopWaitCursor(JComponent component) { RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor()); root.getGlassPane().setCursor(DEFAULT_CURSOR); root.getGlassPane().removeMouseListener(CLICK_CONSUMER); root.getGlassPane().setVisible(false); root.getRootPane().validate(); }
Example #22
Source File: FullScreenHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #23
Source File: FullScreenHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void handleFullScreenEventFromNative(final Window window, final int type) { if (!(window instanceof RootPaneContainer)) return; // handles null SunToolkit.executeOnEventHandlerThread(window, new Runnable() { public void run() { final FullScreenHandler handler = getHandlerFor((RootPaneContainer)window); if (handler != null) handler.notifyListener(new FullScreenEvent(window), type); } }); }
Example #24
Source File: SeaGlassTitlePane.java From seaglass with Apache License 2.0 | 5 votes |
/** * Creates a new SeaGlassTitlePane object. * * @param rootPane the JRootPane containing the title pane. * @param ui the UI delegate for the root pane. */ public SeaGlassTitlePane(JRootPane rootPane, SeaGlassRootPaneUI ui) { this.rootPane = rootPane; this.rootPaneUI = ui; rootParent = (RootPaneContainer) rootPane.getParent(); installTitlePane(); }
Example #25
Source File: FullScreenHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static void handleFullScreenEventFromNative(final Window window, final int type) { if (!(window instanceof RootPaneContainer)) return; // handles null SunToolkit.executeOnEventHandlerThread(window, new Runnable() { public void run() { final FullScreenHandler handler = getHandlerFor((RootPaneContainer)window); if (handler != null) handler.notifyListener(new FullScreenEvent(window), type); } }); }
Example #26
Source File: FullScreenHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #27
Source File: CursorControlUtilities.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
public static void startWaitCursor(JComponent component) { RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor()); root.getGlassPane().setCursor(WAIT_CURSOR); root.getGlassPane().addMouseListener(CLICK_CONSUMER); root.getGlassPane().setVisible(true); root.getRootPane().validate(); }
Example #28
Source File: FullScreenHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) { final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY); if (value instanceof FullScreenHandler) { ((FullScreenHandler)value).addListener(listener); return; } if (value != null) return; // some other garbage is in our client property final FullScreenHandler newHandler = new FullScreenHandler(); newHandler.addListener(listener); window.getRootPane().putClientProperty(CLIENT_PROPERTY, newHandler); }
Example #29
Source File: FullScreenHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static void handleFullScreenEventFromNative(final Window window, final int type) { if (!(window instanceof RootPaneContainer)) return; // handles null SunToolkit.executeOnEventHandlerThread(window, new Runnable() { public void run() { final FullScreenHandler handler = getHandlerFor((RootPaneContainer)window); if (handler != null) handler.notifyListener(new FullScreenEvent(window), type); } }); }
Example #30
Source File: MWaitCursor.java From javamelody with Apache License 2.0 | 5 votes |
/** * Restore l'ancien curseur, en fin de traitement. */ public void restore() { if (window instanceof RootPaneContainer) { final Component glassPane = ((RootPaneContainer) window).getGlassPane(); glassPane.setVisible(windowGlassPaneVisible); glassPane.setCursor(oldWindowCursor); } if (window != null) { window.setCursor(oldWindowCursor); } }