Module java.desktop
Package javax.swing

Class FocusManager

所有已实现的接口:
KeyEventDispatcher, KeyEventPostProcessor
直接已知的子类:
DefaultFocusManager

public abstract class FocusManager extends DefaultKeyboardFocusManager
该类已被1.4焦点API所废弃。虽然客户端代码仍可使用该类,但强烈建议开发人员改用java.awt.KeyboardFocusManagerjava.awt.DefaultKeyboardFocusManager

请参阅如何使用焦点子系统,这是Java教程中的一个部分,以及焦点规范获取更多信息。

自版本:
1.2
另请参见:
  • Field Details

    • FOCUS_MANAGER_CLASS_PROPERTY

      public static final String FOCUS_MANAGER_CLASS_PROPERTY
      该字段已过时,不建议使用,因为其规范与1.4焦点API不兼容。当前的FocusManager不再是UI的属性。客户端代码必须使用KeyboardFocusManager.getCurrentKeyboardFocusManager()查询当前的FocusManager。有关更多信息,请参阅焦点规范。
      另请参见:
  • Constructor Details

    • FocusManager

      protected FocusManager()
      子类调用的构造函数。
  • Method Details

    • getCurrentManager

      public static FocusManager getCurrentManager()
      返回调用线程上下文中当前的KeyboardFocusManager实例。
      返回:
      该线程上下文的KeyboardFocusManager
      另请参见:
    • setCurrentManager

      public static void setCurrentManager(FocusManager aFocusManager) throws SecurityException
      设置调用线程上下文中当前的KeyboardFocusManager实例。如果指定null,则当前的KeyboardFocusManager将被替换为DefaultKeyboardFocusManager的新实例。

      如果安装了SecurityManager,则调用线程必须被授予AWTPermission "replaceKeyboardFocusManager"权限才能替换当前的KeyboardFocusManager。如果未授予此权限,此方法将抛出SecurityException,当前的KeyboardFocusManager将保持不变。

      参数:
      aFocusManager - 该线程上下文的新KeyboardFocusManager
      抛出:
      SecurityException - 如果调用线程没有权限替换当前的KeyboardFocusManager
      另请参见:
    • disableSwingFocusManager

      @Deprecated public static void disableSwingFocusManager()
      Deprecated.
      as of 1.4, replaced by KeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy)
      将当前KeyboardFocusManager的默认FocusTraversalPolicy更改为DefaultFocusTraversalPolicy
      另请参见:
    • isFocusManagerEnabled

      @Deprecated public static boolean isFocusManagerEnabled()
      Deprecated.
      As of 1.4, replaced by KeyboardFocusManager.getDefaultFocusTraversalPolicy()
      返回应用程序是否调用了disableSwingFocusManager()
      返回:
      如果焦点管理器已启用,则返回true
      另请参见: