模块  java.desktop
软件包  javax.swing

Class FocusManager

    • 字段详细信息

      • FOCUS_MANAGER_CLASS_PROPERTY

        public static final String FOCUS_MANAGER_CLASS_PROPERTY
        该字段已过时,不鼓励使用它,因为其规范与1.4焦点API不兼容。 当前的FocusManager不再是UI的属性。 客户端代码必须使用KeyboardFocusManager.getCurrentKeyboardFocusManager()查询当前的FocusManager。 有关详细信息,请参阅焦点规范。
        另请参见:
        KeyboardFocusManager.getCurrentKeyboardFocusManager()Focus Specification常数字段值
    • 构造方法详细信息

      • FocusManager

        public FocusManager()
    • 方法详细信息

      • setCurrentManager

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

        如果安装了SecurityManager ,则必须为调用线程授予AWTPermission “replaceKeyboardFocusManager”以替换当前的KeyboardFocusManager 如果未授予此权限,则此方法将抛出SecurityException ,并且当前KeyboardFocusManager将保持不变。

        参数
        aFocusManager - 此线程的上下文的新 KeyboardFocusManager
        异常
        SecurityException - 如果调用线程无权替换当前 KeyboardFocusManager
        另请参见:
        getCurrentManager()DefaultKeyboardFocusManager
      • isFocusManagerEnabled

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