Example usage for java.awt Window getWindows

List of usage examples for java.awt Window getWindows

Introduction

In this page you can find the example usage for java.awt Window getWindows.

Prototype

public static Window[] getWindows() 

Source Link

Document

Returns an array of all Window s, both owned and ownerless, created by this application.

Usage

From source file:de.bwravencl.controllerbuddy.gui.Main.java

private static boolean isModalDialogShowing() {
    final var windows = Window.getWindows();
    if (windows != null)
        for (final Window w : windows)
            if (w.isShowing() && w instanceof Dialog && ((Dialog) w).isModal())
                return true;

    return false;
}

From source file:net.sf.jabref.gui.JabRefFrame.java

/**
 * Tears down all things started by JabRef
 * <p>//from   ww w  .jav  a 2 s . c o  m
 * FIXME: Currently some threads remain and therefore hinder JabRef to be closed properly
 *
 * @param filenames the filenames of all currently opened files - used for storing them if prefs openLastEdited is set to true
 */
private void tearDownJabRef(List<String> filenames) {
    JabRefExecutorService.INSTANCE.shutdownEverything();

    dispose();

    if (getCurrentBasePanel() != null) {
        getCurrentBasePanel().saveDividerLocation();
    }

    //prefs.putBoolean(JabRefPreferences.WINDOW_MAXIMISED, (getExtendedState()&MAXIMIZED_BOTH)>0);
    prefs.putBoolean(JabRefPreferences.WINDOW_MAXIMISED, getExtendedState() == Frame.MAXIMIZED_BOTH);

    prefs.putBoolean(JabRefPreferences.TOOLBAR_VISIBLE, tlb.isVisible());
    // Store divider location for side pane:
    int width = splitPane.getDividerLocation();
    if (width > 0) {
        prefs.putInt(JabRefPreferences.SIDE_PANE_WIDTH, width);
    }
    if (prefs.getBoolean(JabRefPreferences.OPEN_LAST_EDITED)) {
        // Here we store the names of all current files. If
        // there is no current file, we remove any
        // previously stored filename.
        if (filenames.isEmpty()) {
            prefs.remove(JabRefPreferences.LAST_EDITED);
        } else {
            prefs.putStringList(JabRefPreferences.LAST_EDITED, filenames);
            File focusedDatabase = getCurrentBasePanel().getBibDatabaseContext().getDatabaseFile();
            new LastFocusedTabPreferences(prefs).setLastFocusedTab(focusedDatabase);
        }

    }

    fileHistory.storeHistory();
    prefs.customExports.store(Globals.prefs);
    prefs.customImports.store();
    CustomEntryTypesManager.saveCustomEntryTypes(prefs);

    // Clear autosave files:
    // TODO: Is this really needed since clearAutoSave() is called in stopAutoSaveManager() a few rows below?
    Globals.getAutoSaveManager().ifPresent(manager -> manager.clearAutoSaves());

    prefs.flush();

    // dispose all windows, even if they are not displayed anymore
    for (Window window : Window.getWindows()) {
        window.dispose();
    }

    // shutdown any timers that are may be active
    Globals.stopAutoSaveManager();
}

From source file:qic.Main.java

public static void reloadLookAndFeel() {
    if (Config.getBooleanProperty(Config.LOOK_AND_FEEL_DECORATED, false)) {
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
        System.setProperty("sun.awt.noerasebackground", "true");
    }/* w ww.j  av  a 2  s  .  c o  m*/
    try {
        String lookAndFeel = Config.getPropety(Config.LOOK_AND_FEEL,
                "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        if (lookAndFeel.startsWith("Substance")) {
            lookAndFeel = "org.pushingpixels.substance.api.skin." + lookAndFeel;
        }
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (Exception e) {
        try {
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

    for (Window window : Window.getWindows()) {
        SwingUtilities.updateComponentTreeUI(window);
    }
}