java.awt.Window.isShowing()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中java.awt.Window.isShowing()方法的一些代码示例,展示了Window.isShowing()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.isShowing()方法的具体详情如下:
包路径:java.awt.Window
类名称:Window
方法名:isShowing

Window.isShowing介绍

[英]Checks if this Window is showing on screen.
[中]检查此窗口是否显示在屏幕上。

代码示例

代码示例来源:origin: stackoverflow.com

List<Window> visibleWindows = new ArrayList<Window>();
for(Window w: Window.getWindows()){
  if(w.isShowing()){
    visibleWindows.add(w);
  }
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

if (window != null && window.isShowing()) {
  return window;

代码示例来源:origin: stackoverflow.com

public static boolean isModalDialogShowing()
{
  Window[] windows = Window.getWindows();
  if( windows != null ) { // don't rely on current implementation, which at least returns [0].
    for( Window w : windows ) {
      if( w.isShowing() && w instanceof Dialog && ((Dialog)w).isModal() )
        return true;
    }
  }
  return false;
}

代码示例来源:origin: net.java.truecommons/truecommons-key-swing

private static void setLastFocusedWindow(Window w) {
  if (null == w || !w.isShowing())
    if (null != (w = lastFocusedWindow.get()) && !w.isShowing())
      w = null;
  lastFocusedWindow = new WeakReference<Window>(w);
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-swing

private static void setLastFocusedWindow(Window w) {
  if (null == w || !w.isShowing())
    if (null != (w = lastFocusedWindow.get()) && !w.isShowing())
      w = null;
  lastFocusedWindow = new WeakReference<Window>(w);
}

代码示例来源:origin: net.java.truevfs/truevfs-key-swing

private static void setLastFocusedWindow(Window w) {
  if (null == w || !w.isShowing())
    if (null != (w = lastFocusedWindow.get()) && !w.isShowing())
      w = null;
  lastFocusedWindow = new WeakReference<Window>(w);
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

public void componentResized(ComponentEvent e) {
    if(getWindowDecorationStyle() == JRootPane.NONE) return;
    
    // paint the non-opaque upper edges
    Window w = getWindow();
    
    if(!w.isShowing()) return;
    
    w.repaint(0, 0, w.getWidth(), 5);
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-core

public boolean isShowing(){
    Window window = searchWindow();
    if( window == null )
      return false;
    return window.isShowing();
  }
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

public void componentMoved(ComponentEvent e) {
  if(getWindowDecorationStyle() == JRootPane.NONE) return;
  
  // paint the non-opaque upper edges
  Window w = getWindow();
  
  if(!w.isShowing()) return;
  w.repaint(0, 0, w.getWidth(), 5);
}

代码示例来源:origin: joel-costigliola/assertj-swing

/**
 * Marks the given window as "ready to use" and if not showing, as "hidden."
 *
 * @param w the given window.
 */
@RunsInCurrentThread
void markExisting(@Nonnull Window w) {
 synchronized (lock) {
  open.put(w, true);
  if (!w.isShowing()) {
   hidden.put(w, true);
  }
 }
}

代码示例来源:origin: net.java.truecommons/truecommons-key-swing

private static @Nullable Window getAnyShowingWindow(
      final Window[] windows) {
    for (int i = 0, l = windows.length; i < l; i++) {
      Window window = windows[i];
      if (window.isShowing())
        return window;

      window = getAnyShowingWindow(window.getOwnedWindows());
      if (window != null)
        return window;
    }

    return null;
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-swing

private static @CheckForNull Window getAnyShowingWindow(
      final Window[] windows) {
    for (int i = 0, l = windows.length; i < l; i++) {
      Window window = windows[i];
      if (window.isShowing())
        return window;

      window = getAnyShowingWindow(window.getOwnedWindows());
      if (window != null)
        return window;
    }

    return null;
  }
}

代码示例来源:origin: net.java.truevfs/truevfs-key-swing

private static @CheckForNull Window getAnyShowingWindow(
      final Window[] windows) {
    for (int i = 0, l = windows.length; i < l; i++) {
      Window window = windows[i];
      if (window.isShowing())
        return window;

      window = getAnyShowingWindow(window.getOwnedWindows());
      if (window != null)
        return window;
    }

    return null;
  }
}

代码示例来源:origin: abbot/abbot

private void scanExistingWindows(Window w) {
  // Make sure we catch subsequent show/hide events for this window
  attachWindowWatcherIfRequired(w);
  Window[] windows = w.getOwnedWindows();
  for (int i=0;i < windows.length;i++) {
    scanExistingWindows(windows[i]);
  }
  openWindows.put(w, Boolean.TRUE);
  if (!w.isShowing()) {
    hiddenWindows.put(w, Boolean.TRUE);
  }
  noteContext(w);
}

代码示例来源:origin: worstcase/gumshoe

public void actionPerformed(ActionEvent e) {
  final Window window = getPopup();
  if(window==null || window.isShowing()) { return; }
  window.pack();
  window.setVisible(true);
}

代码示例来源:origin: org.jdesktop.bsaf/bsaf

@Override
  public void hierarchyChanged(HierarchyEvent e) {
    if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
      if (e.getSource() instanceof Window) {
        Window secondaryWindow = (Window) e.getSource();
        if (!secondaryWindow.isShowing()) {
          saveSession(secondaryWindow);
        }
      }
    }
  }
}

代码示例来源:origin: net.java.dev.appframework/appframework

public void hierarchyChanged(HierarchyEvent e) {
  if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
  if (e.getSource() instanceof Window) {
    Window secondaryWindow = (Window)e.getSource();
    if (!secondaryWindow.isShowing()) {
    saveSession(secondaryWindow);
    }
  }
  }
}
}

代码示例来源:origin: de.sciss/scisslib

private void learnWindow( Container c )
{
  if( c != null && c instanceof Window ) {
    win = (Window) c;
    win.addWindowListener( winL );
    win.addComponentListener( cmpL );
    if( EventManager.DEBUG_EVENTS ) {
      System.err.println( "DynamicAncestorAdapter added WindowListener : "+
        win.getClass().getName() );
    }
    if( !listening && win.isShowing() ) startListening();
  }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

/**
   * Center a window on a parent window
   */
  public static void centerWindow(Window parent, Window child) {
    Dimension parentSize = parent.getSize();
    Dimension childSize = child.getSize();
    
    Point parentLocation = new Point(0, 0);
    if (parent.isShowing()) {
      parentLocation = parent.getLocationOnScreen();
    }

    int x = parentLocation.x + parentSize.width / 2 - childSize.width / 2;
    int y = parentLocation.y + parentSize.height / 2 - childSize.height / 2;

    child.setLocation(x, y);
  }
}

代码示例来源:origin: net.java.truecommons/truecommons-key-swing

@Override
  public void hierarchyChanged(final HierarchyEvent e) {
    if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED)
        != HierarchyEvent.SHOWING_CHANGED)
      return;
    final Window window = getAncestorWindow();
    assert null != window : "A showing panel must have a containing window!";
    final boolean windowShown = window.isShowing();
    if (windowShown != isShowing())
      return;
    processPanelEvent(new PanelEvent(EnhancedPanel.this,
        windowShown
          ? PanelEvent.ANCESTOR_WINDOW_SHOWN
          : PanelEvent.ANCESTOR_WINDOW_HIDDEN));
  }
} // class EnhancedPanelHierarchyListener

相关文章

Window类方法