java.awt.Window#getWindows ( )源码实例Demo

下面列出了java.awt.Window#getWindows ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: Test6541987.java
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());
        }
    }
}
 
源代码2 项目: TencentKona-8   文件: Test6541987.java
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());
        }
    }
}
 
源代码3 项目: jdk8u60   文件: Test6541987.java
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());
        }
    }
}
 
源代码4 项目: openjdk-jdk8u   文件: Test6541987.java
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());
        }
    }
}
 
源代码5 项目: marathonv5   文件: WindowTitle.java
public String getTitle() {
    String title = getTitleFromNP(window);
    Window[] windows = Window.getWindows();
    String original = title;
    int index = 1;
    for (Window w : windows) {
        if (w == window) {
            return title;
        }
        if (!w.isVisible()) {
            continue;
        }
        String wTitle = getTitleFromNP(w);
        if (original.equals(wTitle)) {
            title = original + "(" + index++ + ")";
        }
    }
    return title;
}
 
源代码6 项目: marathonv5   文件: EventQueueDevice.java
public Component getComponent() {
    if (component == null) {
        Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
        if (activeWindow != null) {
            return activeWindow.getFocusOwner();
        }
        Window[] windows = Window.getWindows();
        if (windows.length > 0) {
            if (windows[0].getFocusOwner() != null) {
                return windows[0].getFocusOwner();
            }
            return windows[0];
        }
    }
    return component;
}
 
源代码7 项目: openjdk-8   文件: Test6541987.java
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());
        }
    }
}
 
源代码8 项目: openjdk-jdk9   文件: Test6541987.java
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    robot.waitForIdle();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    robot.waitForIdle();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
源代码9 项目: megamek   文件: MegaMekGUI.java
@Override
public void preferenceChange(PreferenceChangeEvent e) {
    // Update to reflect new skin
    if (e.getName().equals(GUIPreferences.SKIN_FILE)) {
        showMainMenu();
        frame.repaint();
    } else if (e.getName().equals(GUIPreferences.UI_THEME)) {
        try {
            UIManager.setLookAndFeel((String)e.getNewValue());
            // We went all Oprah and gave everybody frames...
            // so now we have to let everybody who got a frame
            // under their chair know that we updated our look
            // and feel.
            for (Frame f : Frame.getFrames()) {
                SwingUtilities.updateComponentTreeUI(f);
            }
            // ...and also all of our windows and dialogs, etc.
            for (Window w : Window.getWindows()) {
                SwingUtilities.updateComponentTreeUI(w);
            }
        } catch (Exception ex) {
            DefaultMmLogger.getInstance().error(getClass(), "preferenceChange(GUIPreferences.UI_THEME)", ex);
        }
    }
}
 
源代码10 项目: jdk8u_jdk   文件: Test6541987.java
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());
        }
    }
}
 
源代码11 项目: hottub   文件: Test6541987.java
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());
        }
    }
}
 
源代码12 项目: netbeans   文件: RemoteAWTService.java
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;
}
 
源代码13 项目: mzmine2   文件: GUIUtils.java
/**
 * Close all open MZmine windows, except the main (project) window
 */
public static void closeAllWindows() {
  for (Window window : Window.getWindows()) {
    if (window instanceof MainWindow)
      continue;
    window.dispose();
  }
}
 
源代码14 项目: gcs   文件: SettingsEditor.java
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;
}
 
源代码15 项目: pumpernickel   文件: VectorImageDemo.java
@Override
public void eventDispatched(AWTEvent event) {
	KeyEvent e = (KeyEvent) event;
	if (e.getKeyCode() == KeyEvent.VK_F6
			&& e.getID() == KeyEvent.KEY_PRESSED) {
		PumpernickelShowcaseApp frame = null;
		for (Window w : Window.getWindows()) {
			if (w instanceof PumpernickelShowcaseApp)
				frame = (PumpernickelShowcaseApp) w;
		}
		VectorImage img = new VectorImage();
		img.getOperations().addListListener(
				new VectorImageInspector.StackTraceListener(), false);

		frame.paint(img.createGraphics());

		inspector.setVectorImage(img);
		cardLayout.show(cardPanel, "inspector");

		if (!VectorImageDemo.this.isShowing()) {
			JComponent content = QDialog.createContentPanel(
					"Would you like to switch to the VectorGraphics2D demo?",
					"Pressing F6 took a snapshot of the current window as a VectorGraphics2D.",
					null, // innerComponent,
					true);
			int option = QDialog.showDialog(frame,
					"Show VectorGraphics Demo",
					QDialog.QUESTION_MESSAGE, content, null, // leftControls,
					DialogFooter.OK_CANCEL_OPTION,
					DialogFooter.OK_OPTION, null, // dontShowKey,
					null, // alwaysApplyKey,
					DialogFooter.EscapeKeyBehavior.TRIGGERS_CANCEL);
			if (option == DialogFooter.OK_OPTION) {
				frame.showDemo(VectorImageDemo.this);
			}
		}
	}
}
 
源代码16 项目: FlatLaf   文件: FlatLaf.java
/**
 * Update UI of all application windows immediately.
 * Invoke after changing LaF.
 */
public static void updateUI() {
	for( Window w : Window.getWindows() )
		SwingUtilities.updateComponentTreeUI( w );
}
 
源代码17 项目: netbeans   文件: FiltersOptionsPanel.java
public void storeTo(ProfilerIDESettings settings) {
    settings.setSourcesColoringEnabled(coloringChoice.isSelected());
    PackageColorer.setRegisteredColors(colors);
    for (Window w : Window.getWindows()) w.repaint();
}
 
源代码18 项目: Pixelitor   文件: Themes.java
public static void updateAllUI() {
    Window[] windows = Window.getWindows();
    for (Window window : windows) {
        SwingUtilities.updateComponentTreeUI(window);
    }
}
 
源代码19 项目: visualvm   文件: FiltersOptionsPanel.java
public void storeTo(ProfilerIDESettings settings) {
    settings.setSourcesColoringEnabled(coloringChoice.isSelected());
    PackageColorer.setRegisteredColors(colors);
    for (Window w : Window.getWindows()) w.repaint();
}
 
源代码20 项目: visualvm   文件: StartupDialog.java
public static JDialog create(String caption, String message, int messageType) {
    // Bugfix #361, set the JDialog to appear in the Taskbar on Windows (ModalityType.APPLICATION_MODAL)
    Window[] windows = Window.getWindows();
    final JDialog d = windows == null || windows.length == 0 ?
            new JDialog(null, caption, JDialog.ModalityType.APPLICATION_MODAL) :
            new JDialog((Frame)null, caption, true);
    
    if (message != null) initDialog(d, message, messageType);
    
    // Bugfix #361, JDialog should use the VisualVM icon for better identification
    List<Image> icons = new ArrayList();
    icons.add(ImageUtilities.loadImage("org/netbeans/core/startup/frame.gif", true)); // NOI18N
    icons.add(ImageUtilities.loadImage("org/netbeans/core/startup/frame24.gif", true)); // NOI18N
    icons.add(ImageUtilities.loadImage("org/netbeans/core/startup/frame32.gif", true)); // NOI18N
    icons.add(ImageUtilities.loadImage("org/netbeans/core/startup/frame48.gif", true)); // NOI18N
    d.setIconImages(icons);
    
    d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    d.setResizable(false);
    d.setLocationRelativeTo(null);
    
    // Bugfix #361, ensure that the dialog will be the topmost visible window after opening
    d.addHierarchyListener(new HierarchyListener() {
        public void hierarchyChanged(HierarchyEvent e) {
            if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                if (d.isShowing()) {
                    // For some reason the dialog created with defined JDialog.ModalityType
                    // isn't displayed on Windows when opened by the NetBeans launcher. This
                    // code seems to workaround it while not breaking anything elsewhere.
                    // Disabled to fix jigsaw, the problem is not reproducible using [email protected]
                    // ComponentPeer peer = d.getPeer();
                    // if (peer != null) peer.setVisible(true);

                    d.removeHierarchyListener(this);
                    d.setAlwaysOnTop(true);
                    d.toFront();
                    d.setAlwaysOnTop(false);
                }
            }
        }
    });
    
    return d;
}