本文整理汇总了Java中java.awt.Window.getWindows方法的典型用法代码示例。如果您正苦于以下问题:Java Window.getWindows方法的具体用法?Java Window.getWindows怎么用?Java Window.getWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Window
的用法示例。
在下文中一共展示了Window.getWindows方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTitle
import java.awt.Window; //导入方法依赖的package包/类
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;
}
示例2: getComponent
import java.awt.Window; //导入方法依赖的package包/类
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;
}
示例3: waitForWindows
import java.awt.Window; //导入方法依赖的package包/类
static private void waitForWindows() {
boolean exit;
do {
exit = true;
for (Window win : Window.getWindows()) {
if (win.isShowing()) {
exit = false;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// do nothing
}
break;
}
}
} while (!exit);
}
示例4: getGUISnapshots
import java.awt.Window; //导入方法依赖的package包/类
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;
}
示例5: main
import java.awt.Window; //导入方法依赖的package包/类
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());
}
}
}
示例6: main
import java.awt.Window; //导入方法依赖的package包/类
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());
}
}
}
示例7: killJOP
import java.awt.Window; //导入方法依赖的package包/类
public static void killJOP() {
Window[] windows = Window.getWindows();
for (Window window : windows) {
if (window instanceof JDialog) {
JDialog dialog = (JDialog) window;
if (dialog.getContentPane().getComponentCount() == 1
&& dialog.getContentPane().getComponent(0) instanceof JOptionPane) {
dialog.dispose();
}
}
}
}
示例8: storeTo
import java.awt.Window; //导入方法依赖的package包/类
public void storeTo(ProfilerIDESettings settings) {
settings.setSourcesColoringEnabled(coloringChoice.isSelected());
PackageColorer.setRegisteredColors(colors);
for (Window w : Window.getWindows()) w.repaint();
}
示例9: addListeners
import java.awt.Window; //导入方法依赖的package包/类
private void addListeners(Class<?> listener) {
Window[] windows = Window.getWindows();
for (Window window : windows) {
addListeners(window, listener);
}
}