for(Window window : Window.getWindows()){ if(window != null && window.isVisible() && window instanceof JFrame){ JFrame jFrame = (JFrame)window; } }
/** * Check whether or not there is an overlay component currently enabled. * * @return true if there is an overlay enabled, otherwise false */ public boolean enabled() { return overlay != null && overlay.isVisible(); }
private boolean isVisibleWindow(Window w) { return w.isVisible() && ((w instanceof JFrame) || (w instanceof JDialog) || (w instanceof JWindow)); }
private boolean isVisibleWindow(Window w) { return w.isVisible() && ((w instanceof JFrame) || (w instanceof JDialog) || (w instanceof JWindow)); }
/** * Returns true if the window with the given id is visible * * @param id the id of the window * @return true if window is visible */ public boolean isVisible(String id) { Window w = windows.get(id); if (w == null) return false; return w.isVisible(); } }
@Override public void run() { synchronized (lock) { while (window.isVisible()) { try { lock.wait(500); } catch (InterruptedException e) { } } } } };
/** * Updates the divider component's location to keep the current proportional divider location. */ public void updateDividerLocation() { if(!window.isVisible()) return; // Reset the last divider location to make sure that the next call to moveComponent doesn't // needlessly recalculate the split ratio. lastDividerLocation = -1; //setDividerLocation((int)(splitRatio*(getOrientation()==HORIZONTAL_SPLIT?getWidth():getHeight()))); setDividerLocation(splitRatio); }
for (Window window: Window.getWindows()) { if (window.isVisible()) { injectResources(window); window.repaint(); if (window instanceof RootPaneContainer) { ((RootPaneContainer) window).getRootPane().revalidate(); } } }
public void actionPerformed(ActionEvent e) { //window.pack(); window.setVisible(!window.isVisible()); } });
private void showPalettes() { for (Window palette : palettes) { if (! palette.isVisible()) { palette.setVisible(true); } } }
/** * Checks if is visible on screen. * * @param component * the component * @return true, if is visible on screen */ public static boolean isVisibleOnScreen(final JComponent component) { final Window window = getWindow(component); if (window != null) { return window.isVisible(); } return false; }
private Collection<Window> collectVisibleFrames(Window window) { if (!window.isVisible()) return Collections.emptyList(); Window[] ownedWindows = window.getOwnedWindows(); ArrayList<Window> visibleWindows = new ArrayList(ownedWindows.length + 1); visibleWindows.add(window); for (Window child : ownedWindows) { visibleWindows.addAll(collectVisibleFrames(child)); } return visibleWindows; }
public static Window[] getWindows() { Window[] ws = Window.getWindows(); List<Window> res = new ArrayList<Window>(); for (Window w : ws) { if (w instanceof JSyDialog) { JSyDialog dialog = (JSyDialog) w; if (!dialog.isSeparatedWindow() && w.isVisible()) { res.add(w); } } else { if (w.isVisible()) { res.add(w); } } } return res.toArray(new Window[res.size()]); } }
@Command public void openWindow(@BindingParam("window") Window win){ if(!win.isVisible()){ win.setVisible(true); win.doHighlighted(); } }
@NotNull public static Window getActiveWindow() { Window[] windows = Window.getWindows(); for (Window each : windows) { if (each.isVisible() && each.isActive()) return each; } return JOptionPane.getRootFrame(); }
/** * Gets the visible parent window. * * @param component * the component to start from * @return the visible parent window or null. */ public static Window getVisibleWindow(Component component) { if (component instanceof JWindow) { return (JWindow) component; } Window w = SwingUtilities.getWindowAncestor(component); if (w != null && !w.isVisible() && w.getParent() != null) { return getVisibleWindow(w.getParent()); } return w; }
public static void backOtherWindows() { Component owner = getMenuComponent(); if(owner instanceof Window){ final Window[] ownedWindows = ((Window) owner).getOwnedWindows(); for(Window w : ownedWindows){ if(w.isVisible()){ w.toBack(); } } } }
private static boolean hasModalDialog(Window w) { if (w == null) { // #63830 return false; } Window[] ws = w.getOwnedWindows(); for(int i = 0; i < ws.length; i++) { if(ws[i] instanceof Dialog && ((Dialog)ws[i]).isModal() && ws[i].isVisible()) { return true; } else if(hasModalDialog(ws[i])) { return true; } } return false; }
/** * Gets the top modal dialog of current window. * * @param w * @return the top modal dialog of current window. */ public static Window getTopModalDialog(Window w) { Window[] ws = w.getOwnedWindows(); for (Window w1 : ws) { if (w1.isVisible() && w1 instanceof Dialog && ((Dialog) w1).isModal()) { return (getTopModalDialog(w1)); } } return w; }
private void toFront() { final Component menuComponent = UITools.getMenuComponent(); if(menuComponent instanceof Frame) { final Frame frame = (Frame) menuComponent; final int state = frame.getExtendedState(); if ((state & Frame.ICONIFIED) != 0) frame.setExtendedState(state & ~Frame.ICONIFIED); } if(menuComponent instanceof Window) { Window window = (Window) menuComponent; if (!window.isVisible()) window.setVisible(true); window.toFront(); window.requestFocus(); } }