Java Code Examples for java.awt.Window#isVisible()
The following examples show how to use
java.awt.Window#isVisible() .
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: Test6541987.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example 2
Source File: Test6541987.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example 3
Source File: Test6541987.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example 4
Source File: Test6541987.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example 5
Source File: GUIBrowser.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public RootNode() { super(); Window[] wns = Frame.getFrames(); wins = new WindowNode[wns.length]; int count = 0; for (Window wn1 : wns) { if (propDialog.showAll || wn1.isVisible()) { count++; } } wins = new WindowNode[count]; count = 0; for (Window wn : wns) { if (propDialog.showAll || wn.isVisible()) { wins[count] = new WindowNode(wn); count++; } } }
Example 6
Source File: Session.java From FancyBing with GNU General Public License v3.0 | 6 votes |
public void restoreLocation(Window window, Window owner, String name) { int x = Integer.MIN_VALUE; int y = Integer.MIN_VALUE; Preferences prefs = getNode(name); if (prefs != null) { x = prefs.getInt("x", Integer.MIN_VALUE); y = prefs.getInt("y", Integer.MIN_VALUE); } if (x == Integer.MIN_VALUE || y == Integer.MIN_VALUE) { if (! window.isVisible()) // use a platform-dependent default (setLocationByPlatform can // only be used, if window not already visible) window.setLocationByPlatform(true); return; } Point ownerLocation = owner.getLocation(); setLocationChecked(window, x + ownerLocation.x, y + ownerLocation.y); }
Example 7
Source File: Test6541987.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example 8
Source File: SysTray.java From visualvm with GNU General Public License v2.0 | 6 votes |
private void hideWindow() { Window[] windows = mainWindow.getOwnedWindows(); for (Window window : windows) { if (window.isVisible() && window instanceof Dialog) if (((Dialog)window).isModal()) { trayPopup.setEnabled(false); DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( Bundle.SysTray_ModalDialog(), NotifyDescriptor.WARNING_MESSAGE)); trayPopup.setEnabled(true); return; } } mainWindow.setVisible(false); if (!Utilities.isWindows() && (mainWindow.getExtendedState() & Frame.ICONIFIED) != 0) { workaround = true; } if (showHideItem != null) showHideItem.setLabel(Bundle.SysTray_Show()); }
Example 9
Source File: InputContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private synchronized void notifyClientWindowChange(Window window) { if (inputMethod == null) { return; } // if the window is invisible or iconified, send null to the input method. if (!window.isVisible() || ((window instanceof Frame) && ((Frame)window).getState() == Frame.ICONIFIED)) { clientWindowLocation = null; inputMethod.notifyClientWindowChange(null); return; } Rectangle location = window.getBounds(); if (clientWindowLocation == null || !clientWindowLocation.equals(location)) { clientWindowLocation = location; inputMethod.notifyClientWindowChange(clientWindowLocation); } }
Example 10
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 6 votes |
/** * Waits for the JDialog with the indicated title and that is parented to the indicated window * <P> * Note: Sometimes the task dialog might have the same title as the dialog you pop up and * you want to get yours instead of the one for the task monitor. * * @param window the parent window * @param title the title of the dialog * @param timeoutMS Maximum time to wait for the dialog * @return the dialog * @deprecated use {@link #waitForJDialog(String)} instead */ @Deprecated public static JDialog waitForJDialog(Window window, String title, int timeoutMS) { int totalTime = 0; while (totalTime <= DEFAULT_WAIT_TIMEOUT) { Set<Window> winList = getWindows(window); Iterator<Window> iter = winList.iterator(); while (iter.hasNext()) { Window w = iter.next(); if ((w instanceof JDialog) && w.isVisible()) { String windowTitle = getTitleForWindow(w); if (title.equals(windowTitle)) { return (JDialog) w; } } } totalTime += sleep(DEFAULT_WAIT_DELAY); } throw new AssertionFailedError("Timed-out waiting for window with title '" + title + "'"); }
Example 11
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 6 votes |
/** * Waits for a window with the given name. * * @param name The name of the window for which to search * @return The window, if found, null otherwise */ public static Window waitForWindowByName(String name) { int time = 0; int timeout = DEFAULT_WAIT_TIMEOUT; while (time <= timeout) { Set<Window> allWindows = getAllWindows(); for (Window window : allWindows) { String windowName = window.getName(); if (name.equals(windowName) && window.isVisible()) { return window; } time += sleep(DEFAULT_WAIT_DELAY); } } throw new AssertionFailedError("Timed-out waiting for window with name '" + name + "'"); }
Example 12
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 6 votes |
public static Window waitForWindow(Class<?> windowClass) { if ((!Dialog.class.isAssignableFrom(windowClass)) && (!Frame.class.isAssignableFrom(windowClass))) { throw new IllegalArgumentException( windowClass.getName() + " does not extend Dialog or Frame."); } int timeout = DEFAULT_WAIT_TIMEOUT; int totalTime = 0; while (totalTime <= timeout) { Set<Window> winList = getAllWindows(); Iterator<Window> it = winList.iterator(); while (it.hasNext()) { Window w = it.next(); if (windowClass.isAssignableFrom(w.getClass()) && w.isVisible()) { return w; } } totalTime += sleep(DEFAULT_WAIT_DELAY); } throw new AssertionFailedError("Timed-out waiting for window of class: " + windowClass); }
Example 13
Source File: InputContext.java From hottub with GNU General Public License v2.0 | 6 votes |
private synchronized void notifyClientWindowChange(Window window) { if (inputMethod == null) { return; } // if the window is invisible or iconified, send null to the input method. if (!window.isVisible() || ((window instanceof Frame) && ((Frame)window).getState() == Frame.ICONIFIED)) { clientWindowLocation = null; inputMethod.notifyClientWindowChange(null); return; } Rectangle location = window.getBounds(); if (clientWindowLocation == null || !clientWindowLocation.equals(location)) { clientWindowLocation = location; inputMethod.notifyClientWindowChange(clientWindowLocation); } }
Example 14
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 5 votes |
/** * Gets the dialog component provider <b>that is inside the given window</b> or null if a * provider of the given class type is not in the window. * * @param window the window that contains the desired provider. * @param ghidraClass the class of the desired provider * @return the desired provider or null if the window does not contain a provider of the given type. */ protected static <T extends DialogComponentProvider> T getDialogComponentProvider(Window window, Class<T> ghidraClass) { if (!(window instanceof DockingDialog)) { return null; } if (!window.isVisible()) { return null; } if (!window.isShowing()) { return null; } DialogComponentProvider provider = ((DockingDialog) window).getDialogComponent(); if (provider == null || !provider.isVisible()) { // provider can be null if the DockingDialog is disposed before we can get the provider return null; } if (!ghidraClass.isAssignableFrom(provider.getClass())) { return null; } return ghidraClass.cast(provider); }
Example 15
Source File: TaskDialog.java From jeveassets with GNU General Public License v2.0 | 5 votes |
private Window getTopWindow(Window in) { for (Window window : in.getOwnedWindows()) { if (window.isVisible()) { return getTopWindow(window); } } return in; }
Example 16
Source File: WindowTable.java From netbeans with Apache License 2.0 | 5 votes |
/** * @param vec is a ArrayList of windows * @param grp is a ThreadGroup that belongs to the ArrayList * @return true if all windows in the ArrayList vec are invisible */ private boolean hiddenWindows(ArrayList<Window> vec) { Iterator<Window> ee = vec.iterator(); Window win; while (ee.hasNext()) { win = ee.next(); if (win.isVisible()) return false; } // windows will be removed later return true; }
Example 17
Source File: JavaHelp.java From netbeans with Apache License 2.0 | 5 votes |
/** * If the help frame is opened from a modal dialog, it should be closed * automatically if that dialog closes. See bug 233543. Also the windows * should be rearranged so that both are visible. See bug #233542. */ private void bindFrameViewerToCurrentDialog() { int maxDepth = 0; Dialog topDialog = null; for (Window w : JDialog.getWindows()) { if (w instanceof Dialog && w.isVisible()) { Dialog d = (Dialog) w; if (isRelevantDialog(d)) { int depth = 0; for (Window o = d.getOwner(); o != null; o = o.getOwner()) { depth++; if (o == WindowManager.getDefault().getMainWindow() && depth > maxDepth) { maxDepth = depth; topDialog = d; break; } } } } } if (topDialog != null) { rearrange(topDialog, frameViewer); final Dialog finalTopDialog = topDialog; topDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { if (frameViewer != null) { frameViewer.setVisible(false); } finalTopDialog.removeWindowListener(this); } }); } }
Example 18
Source File: Session.java From FancyBing with GNU General Public License v3.0 | 5 votes |
public void saveVisible(Window window, String name) { boolean isVisible = (window != null && window.isVisible()); Preferences prefs = createNode(null); if (prefs == null) return; prefs.putBoolean("show-" + name, isVisible); }
Example 19
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 5 votes |
protected static Window getWindowByTitle(Window parentWindow, String title) { Set<Window> winList = getWindows(parentWindow); Iterator<Window> iter = winList.iterator(); while (iter.hasNext()) { Window w = iter.next(); if (!w.isVisible()) { continue; } String titleForWindow = getTitleForWindow(w); if (title.equals(titleForWindow)) { return w; } } return null; }
Example 20
Source File: RemoteAWTService.java From netbeans with Apache License 2.0 | 5 votes |
static Snapshot[] getGUISnapshots() { List snapshots = new ArrayList(); //System.err.println("gGUI: thread = "+Thread.currentThread()); Window[] windows = Window.getWindows(); //System.err.println("gGUI: windows = "+windows.length); for (int wi = 0; wi < windows.length; wi++) { Window w = windows[wi]; //System.err.println("gGUI: w["+wi+"] = "+w+", is visible = "+w.isVisible()); if (!w.isVisible()) { continue; } Dimension d = w.getSize(); //System.err.println("gGUI: size = "+d); if (d.width == 0 || d.height == 0) { continue; } BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT); w.paint(g); Raster raster = bi.getData(); Object data = raster.getDataElements(0, 0, d.width, d.height, null); int[] dataArr; //System.err.println("gGUI: data = "+data); if (data instanceof int[]) { dataArr = (int[]) data; } else { continue; } String title = null; if (w instanceof Frame) { title = ((Frame) w).getTitle(); } else if (w instanceof Dialog) { title = ((Dialog) w).getTitle(); } //System.err.println("gGUI: title = "+title); snapshots.add(new Snapshot(w, title, d.width, d.height, dataArr)); } Snapshot[] snapshotArr = (Snapshot[]) snapshots.toArray(new Snapshot[] {}); lastGUISnapshots = snapshotArr; return snapshotArr; }