当前位置: 首页>>代码示例>>Java>>正文


Java Window.isVisible方法代码示例

本文整理汇总了Java中java.awt.Window.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Window.isVisible方法的具体用法?Java Window.isVisible怎么用?Java Window.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Window的用法示例。


在下文中一共展示了Window.isVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValidWindows

import java.awt.Window; //导入方法依赖的package包/类
private Window[] getValidWindows() {
    List<Window> valid = new ArrayList<Window>();
    Set<AppContext> appContexts = AppContext.getAppContexts();
    for (AppContext appContext : appContexts) {
        Window[] windows = getWindows(appContext);
        for (Window window : windows) {
            if (window.getClass().getName().equals("javax.swing.SwingUtilities$SharedOwnerFrame")) {
                continue;
            }
            if (window.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow")) {
                continue;
            }
            if (window.isVisible()) {
                valid.add(window);
            }
        }
    }
    return valid.toArray(new Window[valid.size()]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:JavaTargetLocator.java

示例2: 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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:WindowTitle.java

示例3: addWindowParents

import java.awt.Window; //导入方法依赖的package包/类
private JSONObject addWindowParents(JSONObject r, Window parent, JSONObject current) {
    while (parent != null) {
        if (!parent.getClass().getName().equals("javax.swing.SwingUtilities$SharedOwnerFrame")
                && !parent.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow") && parent.isVisible()) {
            JSONObject pWindow = getContextJSONObject(parent);
            if (r == null) {
                r = pWindow;
            }
            if (current != null) {
                current.put("container", pWindow);
            }
            current = pWindow;
        }
        parent = parent.getOwner();
    }
    return r;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:RComponent.java

示例4: executeCommand

import java.awt.Window; //导入方法依赖的package包/类
public void executeCommand() {
  PrivateChatter chat = mgr.getChatterFor(p);
  if (chat == null) {
    return;
  }

  Window f = SwingUtilities.getWindowAncestor(chat);
  if (!f.isVisible()) {
    f.setVisible(true);
    Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager()
                                      .getFocusOwner();
    if (c == null || !SwingUtilities.isDescendingFrom(c, f)) {
      java.awt.Toolkit.getDefaultToolkit().beep();
      for (int i = 0,j = chat.getComponentCount(); i < j; ++i) {
        if (chat.getComponent(i) instanceof JTextField) {
          (chat.getComponent(i)).requestFocus();
          break;
        }
      }
    }
  }
  else {
    f.toFront();
  }
  chat.show(msg);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:27,代码来源:PrivMsgCommand.java

示例5: findChildWindow

import java.awt.Window; //导入方法依赖的package包/类
/**
 * Finds the first direct child window of the given window that matches the
 * specified attributes.
 * 
 * @param baseWindow the parent window.
 * @param isVisible the child window must be visible or not.
 * @param isActive the child window must be active or not.
 * @return a child window matching the attributes, or null if none found.
 */
public static Window findChildWindow(Window baseWindow, boolean isVisible, boolean isActive)
{
	Window ownedWindows[] = baseWindow.getOwnedWindows();
	for( int i = 0; i < ownedWindows.length; ++i )
	{
		Window w = ownedWindows[i];

		// If this is an active Frame or Dialog then start again from it:
		if( (w instanceof Frame) || ((w instanceof Dialog) && ((Dialog) w).isModal()) )
		{
			boolean check1 = !(isVisible ^ w.isVisible());
			boolean check2 = !(isActive ^ w.isActive());

			if( check1 && check2 )
			{
				return ownedWindows[i];
			}
		}
	}

	return null;
}
 
开发者ID:equella,项目名称:Equella,代码行数:32,代码来源:ComponentHelper.java

示例6: WindowNode

import java.awt.Window; //导入方法依赖的package包/类
public WindowNode(Window win) {
    super(win);
    Window[] wns = win.getOwnedWindows();
    Vector<WindowNode> wwns = new Vector<>();
    for (Window wn : wns) {
        if (propDialog.showAll || wn.isVisible()) {
            wwns.add(new WindowNode(wn));
        }
    }
    wins = new WindowNode[wwns.size()];
    for (int i = 0; i < wwns.size(); i++) {
        wins[i] = wwns.get(i);
    }
    title = win.toString();
    clss = win.getClass().getName();
    BufferedImage image = null;
    try {
        image = new Robot().
                createScreenCapture(new Rectangle(win.getLocationOnScreen(),
                        win.getSize()));
    } catch (AWTException e) {
        e.printStackTrace();
    }
    setComponentImageProvider(new ComponentImageProvider(image, x, y));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:GUIBrowser.java

示例7: 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:RemoteAWTService.java

示例8: bindFrameViewerToCurrentDialog

import java.awt.Window; //导入方法依赖的package包/类
/**
 * 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);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:JavaHelp.java

示例9: hiddenWindows

import java.awt.Window; //导入方法依赖的package包/类
/**
* @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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:WindowTable.java

示例10: notifyClientWindowChange

import java.awt.Window; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:InputContext.java

示例11: run

import java.awt.Window; //导入方法依赖的package包/类
/**
 *  Main processing method for the FileChooserFixer object
 */
public void run() {
	try {
		while (true) {
			Thread.sleep(rescanTime);
			Window w = SwingUtilities.windowForComponent(fileChooser);
			if (w != null && w.isVisible()) {
				fileChooser.rescanCurrentDirectory();
			}
		}
	}
	catch (Throwable err) {}
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:16,代码来源:FileChooserFixer.java

示例12: 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());
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:Test6541987.java

示例13: test

import java.awt.Window; //导入方法依赖的package包/类
public static void test(final Window window,
        final List<BufferedImage> imageList) throws Exception {

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            for (BufferedImage image : imageList) {
                Graphics graphics = image.getGraphics();
                graphics.setColor(Color.RED);
                graphics.fillRect(
                        0, 0, image.getWidth(), image.getHeight());
                graphics.dispose();
            }

            window.setIconImages(imageList);
            window.setSize(200, 200);
            window.setVisible(true);
        }
    });

    while (!window.isVisible()) {
        Thread.sleep((long) (20));
    }

    Thread.sleep((long) (50));

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            window.setVisible(false);
            window.dispose();
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:SetIconImagesCrashTest.java

示例14: 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());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Test6541987.java

示例15: RootNode

import java.awt.Window; //导入方法依赖的package包/类
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++;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:GUIBrowser.java


注:本文中的java.awt.Window.isVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。