for (Window w : Window.getWindows()) { SwingUtilities.updateComponentTreeUI(w); if (w.isDisplayable() && (w instanceof Frame ? !((Frame)w).isResizable() : w instanceof Dialog ? !((Dialog)w).isResizable() : true)) w.pack(); }
/** * {@inheritDoc} */ @Override protected String[] getMenuItemNames() { final Window[] windows = Window.getWindows(); final List<String> titles = new ArrayList<String>(); for ( Window window : windows ) { if ( window.isDisplayable() ) { titles.add( FocusWindowAction.getTitle( window ) ); } } return titles.toArray( new String[titles.size()] ); }
public static void updateLookAndFeel() { for (Window w : Window.getWindows()) { if (w.isDisplayable()) { SwingUtilities.updateComponentTreeUI(w); } } } }
private void fixWindowDragging(Window w, String context) { if (w instanceof RootPaneContainer) { JRootPane p = ((RootPaneContainer)w).getRootPane(); Boolean oldDraggable = (Boolean)p.getClientProperty(WDRAG); if (oldDraggable == null) { p.putClientProperty(WDRAG, Boolean.FALSE); if (w.isDisplayable()) { System.err.println(context + "(): To avoid content dragging, " + context + "() must be called before the window is realized, or " + WDRAG + " must be set to Boolean.FALSE before the window is realized. If you really want content dragging, set " + WDRAG + " on the window's root pane to Boolean.TRUE before calling " + context + "() to hide this message."); } } } }
@Override protected void postSetAction(final Boolean visible) { LOGGER.debug("Run the set action, visible: {}", visible); if (visible) { LOGGER.info("Show the task dialog."); dlg.pack(); // location is set relative to currently active window or dialog owner if no active window found // this way task dialog stays on the same monitor as it's owner Window window = dlg.getOwner(); if (window == null) { window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if (window != null && !window.isDisplayable()) window = null; } dlg.setLocationRelativeTo(window); dlg.setVisible(true); } else { LOGGER.info("Hide the task dialog."); dlg.setVisible(false); dlg.dispose(); // releases native resources LOGGER.info("Hide the task dialog finished."); } } };
private void fixWindowDragging(Window w, String context) { if (w instanceof RootPaneContainer) { JRootPane p = ((RootPaneContainer)w).getRootPane(); Boolean oldDraggable = (Boolean)p.getClientProperty(WDRAG); if (oldDraggable == null) { p.putClientProperty(WDRAG, Boolean.FALSE); if (w.isDisplayable()) { LOG.log(Level.WARNING, "{0}(): To avoid content dragging, {1}() must be called before the window is realized, or " + WDRAG + " must be set to Boolean.FALSE before the window is realized. If you really want content dragging, set " + WDRAG + " on the window''s root pane to Boolean.TRUE before calling {2}() to hide this message.", new Object[]{context, context, context}); } } } }
@Override protected void setValue(Boolean visible) { if ( visible ) { // set commands first because they may depend on "visible" property change content.setCommands(commands, getDesign().isCommandButtonSizeLocked()); } if ( visible ) { dlg.pack(); // location is set relative to currently active window or dialog owner if no active window found // this way task dialog stays on the same monitor as it's owner Window window = dlg.getOwner(); if ( window == null ) { window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if (window != null && !window.isDisplayable()) window = null; } dlg.setLocationRelativeTo( window ); dlg.setVisible(true); } else { dlg.dispose(); // releases native resources } } };
/** * Refresh UI after LAF change or resizing */ public static final void refreshUI() { for (Window w : Window.getWindows()) { SwingUtilities.updateComponentTreeUI(w); if (w.isDisplayable() && (w instanceof Frame ? !((Frame)w).isResizable() : w instanceof Dialog ? !((Dialog)w).isResizable() : true)) { w.pack(); } } }
if (isShowing) { Window compWindow = SwingUtilities.getWindowAncestor(comp); if (!compWindow.isDisplayable() || !compWindow.isShowing() || !compWindow.isVisible()) { isShowing = false; if (w.isDisplayable() && w.isVisible() && w.isShowing()) { w.repaint(); if (w == root) continue; if (w.isDisplayable() && w.isVisible() && w.isShowing()) { if (w.getBounds().intersects(compRect)) { int winRepaintX = compRect.x