Java Code Examples for java.awt.Window#isShowing()
The following examples show how to use
java.awt.Window#isShowing() .
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: TestEnv.java From ghidra with Apache License 2.0 | 6 votes |
private void printOpenModalDialogs() { boolean hasModal = false; Set<Window> windows = AbstractGenericTest.getAllWindows(); for (Window window : windows) { if (window instanceof Dialog) { if (((Dialog) window).isModal() && window.isShowing()) { hasModal = true; break; } } } if (!hasModal) { return; } String windowInfo = AbstractDockingTest.getOpenWindowsAsString(); if (!windowInfo.isEmpty()) { Msg.error(TestEnv.class, "Open modal dialogs - all windows: " + windowInfo); } }
Example 2
Source File: ScrTypes.java From PolyGlot with MIT License | 6 votes |
/** * Closes all child windows */ private void killAllChildren() { Iterator<Window> it = childFrames.iterator(); while (it.hasNext()) { Window curFrame = it.next(); if (curFrame != null && curFrame.isShowing()) { curFrame.setVisible(false); curFrame.dispose(); } } childFrames.clear(); }
Example 3
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 5 votes |
public static void closeAllWindows(boolean showError) { boolean firstClose = true; for (Window window : getAllWindows()) { if (!window.isShowing()) { continue; } if (showError) { if (firstClose) { // only print once firstClose = false; printOpenWindows(); } // note: we use System.err here to get more obvious errors in the console String title = getDebugTitleForWindow(window); System.err.println("DockingTestCase - Forced window closure: " + title); String errorMessage = checkMessageDisplay(window); if (errorMessage != null) { System.err.println("\tWindow error message: " + errorMessage); } } Window w = window; runSwing(() -> w.dispose()); } }
Example 4
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 5
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 5 votes |
private static boolean isHierarchyShowing(Window w) { if (w.isShowing()) { return true; } Window[] children = w.getOwnedWindows(); for (Window child : children) { if (child.isShowing()) { return true; } } return false; }
Example 6
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 5 votes |
private static void windowToString(Window w, int depth, StringBuilder buffy) { String title = getDebugTitleForWindow(w); String prefix = StringUtils.repeat('\t', depth); String visibility = w.isShowing() ? "" : " (not showing)"; String padded = prefix + title + visibility; buffy.append(padded).append('\n'); Window[] children = w.getOwnedWindows(); for (Window child : children) { windowToString(child, depth + 1, buffy); } }
Example 7
Source File: NbClipboardTest.java From netbeans with Apache License 2.0 | 5 votes |
private static void waitEQ(final Window w) throws Exception { class R implements Runnable { boolean visible; public void run() { visible = w.isShowing(); } } R r = new R(); while (!r.visible) { SwingUtilities.invokeAndWait(r); } }
Example 8
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 9
Source File: SettingsEditor.java From gcs with Mozilla Public License 2.0 | 5 votes |
public static SettingsEditor find(GURPSCharacter character) { for (Window window : Window.getWindows()) { if (window.isShowing() && window instanceof SettingsEditor) { SettingsEditor wnd = (SettingsEditor) window; if (wnd.mCharacter == character) { return wnd; } } } return null; }
Example 10
Source File: BaseWindow.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * @param window The window to check. * @return {@code true} if an owned window is showing. */ public static boolean hasOwnedWindowsShowing(Window window) { if (window != null) { for (Window one : window.getOwnedWindows()) { if (one.isShowing() && one.getType() != Window.Type.POPUP) { return true; } } } return false; }
Example 11
Source File: CloseCommand.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * @param window The {@link Window} to close. * @return Whether the window was closed or not. */ public static boolean close(Window window) { if (window == null) { return true; } window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING)); return !window.isShowing(); }
Example 12
Source File: Preferences.java From pdfxtk with Apache License 2.0 | 5 votes |
void grab(boolean setATime, Window w) { bounds = w.getBounds(); showing = w.isShowing(); if(w instanceof Frame) icon = ((Frame)w).getState() == Frame.ICONIFIED; if(setATime) activationTime = System.currentTimeMillis(); }
Example 13
Source File: ControlWindow.java From osp with GNU General Public License v3.0 | 5 votes |
public void show() { // ((Window) getComponent()).show(); if(startingup) { shouldShow = true; if(waitForReset) { return; } } Window w = (Window) getComponent(); if(w.isShowing()) { // empty // System.out.println("Window "+this+" is showing "+w.isShowing()); } else { w.setVisible(true); } }
Example 14
Source File: ControlWindow.java From osp with GNU General Public License v3.0 | 5 votes |
public void hide() { // ((Window) getComponent()).show(); if(startingup) { shouldShow = false; if(waitForReset) { return; } } Window w = (Window) getComponent(); if(w.isShowing()) { w.setVisible(false); } }