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

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

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

Window.isAncestorOf介绍

暂无

代码示例

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

/** Removes a desktop from this context */
public void removeDesktop(DockingDesktop desktop) {
  desktops.remove(desktop);
  // time to check if some windows should be removed as not ancestors of remaining desktops
  Iterator it = ownedWindowActivationOrder.iterator();
  while(it.hasNext()) {
    Window w = (Window) it.next();
    boolean ancestor = false;
    for(int i = 0; i < desktops.size(); i++) {
      DockingDesktop desk = (DockingDesktop) desktops.get(i);
      if(w.isAncestorOf(desk)) {
        ancestor = true;
        break;
      }
    }
    if(! ancestor) {
      // this window isn't an ancestor of any managed desktops : we drop it
      it.remove();
    }
  }
}

代码示例来源:origin: jawi/ols

/**
 * Returns whether the given component is "actively" shown in screen, that is,
 * it or any of its ancestors is focused.
 * 
 * @param aComponent
 *          the component to determine whether it is actively shown on screen,
 *          may be <code>null</code>.
 * @return <code>true</code> if the given component is actively shown,
 *         <code>false</code> otherwise.
 */
public static final boolean isActivelyShown( final Component aComponent )
{
 final KeyboardFocusManager kbdFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
 final Window owner = kbdFocusManager.getFocusedWindow();
 return ( ( aComponent != null ) && ( owner != null ) && ( ( owner == aComponent ) || owner
   .isAncestorOf( aComponent ) ) );
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
  public void run() {
    Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    //in Java 1.5+ KeyboardFocusManager.getActiveWindow() may return null
    if (null != w && w.isAncestorOf(ComboInplaceEditor.this)) {
      if (isShowing() && !isPopupVisible()) {
        log("Popup checker ensuring editor prepared or popup visible");
        if (isEditable()) {
          prepareEditor();
        }
        showPopup();
      }
      checker = null;
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public void run() {
    Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    if (w.isAncestorOf(ComboInplaceEditor.this)) {
      if (isShowing() && !isPopupVisible()) {
        log ("Popup checker ensuring editor prepared or popup visible");
        if (isEditable()) {
          prepareEditor();
        } else {
          showPopup();
        }
      }
      checker = null;
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public void run() {
    Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    if (w.isAncestorOf(ComboInplaceEditor.this)) {
      if (isShowing() && !isPopupVisible()) {
        log ("Popup checker ensuring editor prepared or popup visible");
        if (isEditable()) {
          prepareEditor();
        } else {
          showPopup();
        }
      }
      checker = null;
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

protected void handleWindowEvent(WindowEvent e) {
  Component owner = getActualOwner();
  if (e.getSource() != getTopLevelAncestor() && e.getWindow() != null && (e.getWindow() == owner || e.getWindow().isAncestorOf(owner))) { // check if it's embedded in browser
    if (e.getID() == WindowEvent.WINDOW_CLOSING || e.getID() == WindowEvent.WINDOW_ICONIFIED) {
      hidePopup(true);

相关文章

Window类方法