setFocusable() 和 setFocusableWindowState() 有什么区别?

What's the difference between setFocusable() and setFocusableWindowState()?

我对这两个 API 感到困惑:

java.awt.Component.setFocusable():

Sets the focusable state of this Component to the specified value. This value overrides the Component's default focusability.

并且:

java.awt.Window.setFocusableWindowState():

Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. If this Window's focusable Window state is set to false, then isFocusableWindow will return false. If this Window's focusable Window state is set to 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.

我会说:

Component.setFocusable() 用于单个组件。

Window.setFocusableWindowState() 是整个 window。如果 window 不能聚焦,那么默认情况下 none 的组件也可以聚焦。这也将被 OS 使用。例如,当您在 Windows 上使用 Alt-Tab 循环浏览 windows 时,任何无法聚焦的 window 都将无法访问。