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

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

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

Window.getFocusableWindowState介绍

[英]Returns whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. If this method returns false, then isFocusableWindow will return false as well. If this method returns true, then isFocusableWindow may return true or false depending upon the other requirements which must be met in order for a Window to be focusable.

By default, all Windows have a focusable Window state of true.
[中]返回如果此窗口满足[$0$]中列出的其他要求,是否可以成为焦点窗口。如果此方法返回false,则isFocusableWindow也将返回false。如果此方法返回true,则isFocusableWindow可能返回truefalse,具体取决于窗口可聚焦所必须满足的其他要求。
默认情况下,所有窗口的可聚焦窗口状态均为[$8$]。

代码示例

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

@Override
  public boolean isFocusable() {
    boolean ret = super.isFocusable();
    if (ret) {
      ret = getAWTComponent().isFocusable() && getAWTComponent().getFocusableWindowState();
    }
    return ret;
  }
}

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

public void pack()
  {
    if( w != null ) {
      // circumvention for bug 1924630 : this throws a NullPointerException
      // with the combination Metal-lnf / java 1.5 / screen menu bar / laf window deco
      // / floating palettes. We have to make sure the window is focusable
      // during pack():
      final boolean wasFocusable = w.getFocusableWindowState();
      if( !wasFocusable ) {
        w.setFocusableWindowState( true );
      }
      w.pack();
      if( !wasFocusable ) {
        w.setFocusableWindowState( false );
      }
    } else if( jif != null ) {
      // bug in swing??
      // when using undecorated windows plus metal-lnf plus lnf-window-deco
//            try { jif.pack(); } catch( NullPointerException e ) {}
      jif.pack();
    } else {
      throw new IllegalStateException();
    }
  }

相关文章

Window类方法