JavaTM Platform
Standard Ed. 6

javax.swing
类 FocusManager

java.lang.Object
  继承者 java.awt.KeyboardFocusManager
      继承者 java.awt.DefaultKeyboardFocusManager
          继承者 javax.swing.FocusManager
所有已实现的接口:
KeyEventDispatcher, KeyEventPostProcessor
直接已知子类:
DefaultFocusManager

public abstract class FocusManager
     
extends DefaultKeyboardFocusManager

从 1.4 focus API 开始,此类已被废弃。虽然客户机代码可能仍然使用此类,但强烈建议开发人员使用 java.awt.KeyboardFocusManagerjava.awt.DefaultKeyboardFocusManager 替代。

有关更多信息,请参阅 The Java Tutorial 中的 How to Use the Focus Subsystem 一节和 Focus Specification

另请参见:
Focus Specification

字段摘要
static String FOCUS_MANAGER_CLASS_PROPERTY
          该字段已被废弃,不鼓励使用它,因为它的规范与 1.4 focus API 不兼容。
 
从类 java.awt.KeyboardFocusManager 继承的字段
BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS
 
构造方法摘要
FocusManager()
           
 
方法摘要
static void disableSwingFocusManager()
          已过时。 从 1.4 开始,由 KeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy) 取代
static FocusManager getCurrentManager()
          返回调用线程上下文的当前 KeyboardFocusManager 实例。
static boolean isFocusManagerEnabled()
          已过时。 从 1.4 开始,由 KeyboardFocusManager.getDefaultFocusTraversalPolicy() 取代
static void setCurrentManager(FocusManager aFocusManager)
          设置调用线程上下文的当前 KeyboardFocusManager 实例。
 
从类 java.awt.DefaultKeyboardFocusManager 继承的方法
dequeueKeyEvents, discardKeyEvents, dispatchEvent, dispatchKeyEvent, downFocusCycle, enqueueKeyEvents, focusNextComponent, focusPreviousComponent, postProcessKeyEvent, processKeyEvent, upFocusCycle
 
从类 java.awt.KeyboardFocusManager 继承的方法
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearGlobalFocusOwner, downFocusCycle, firePropertyChange, fireVetoableChange, focusNextComponent, focusPreviousComponent, getActiveWindow, getCurrentFocusCycleRoot, getCurrentKeyboardFocusManager, getDefaultFocusTraversalKeys, getDefaultFocusTraversalPolicy, getFocusedWindow, getFocusOwner, getGlobalActiveWindow, getGlobalCurrentFocusCycleRoot, getGlobalFocusedWindow, getGlobalFocusOwner, getGlobalPermanentFocusOwner, getKeyEventDispatchers, getKeyEventPostProcessors, getPermanentFocusOwner, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, redispatchEvent, removeKeyEventDispatcher, removeKeyEventPostProcessor, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setCurrentKeyboardFocusManager, setDefaultFocusTraversalKeys, setDefaultFocusTraversalPolicy, setGlobalActiveWindow, setGlobalCurrentFocusCycleRoot, setGlobalFocusedWindow, setGlobalFocusOwner, setGlobalPermanentFocusOwner, upFocusCycle
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

FOCUS_MANAGER_CLASS_PROPERTY

public static final String FOCUS_MANAGER_CLASS_PROPERTY
该字段已被废弃,不鼓励使用它,因为它的规范与 1.4 focus API 不兼容。当前的 FocusManager 已经不再是 UI 的一个属性。客户端代码必须使用 KeyboardFocusManager.getCurrentKeyboardFocusManager() 来查询当前的 FocusManager。有关更多信息,请参阅 Focus Specification。

另请参见:
KeyboardFocusManager.getCurrentKeyboardFocusManager(), Focus Specification, 常量字段值
构造方法详细信息

FocusManager

public FocusManager()
方法详细信息

getCurrentManager

public static FocusManager getCurrentManager()
返回调用线程上下文的当前 KeyboardFocusManager 实例。

返回:
此线程上下文的 KeyboardFocusManager
另请参见:
setCurrentManager(javax.swing.FocusManager)

setCurrentManager

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

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

参数:
aFocusManager - 此线程上下文的新 KeyboardFocusManager
抛出:
SecurityException - 如果调用线程没有替换当前 KeyboardFocusManager 的权限
另请参见:
getCurrentManager(), DefaultKeyboardFocusManager

disableSwingFocusManager

@Deprecated
public static void disableSwingFocusManager()
已过时。  从 1.4 开始,由 KeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy) 取代

将当前 KeyboardFocusManager 的默认 FocusTraversalPolicy 更改为 DefaultFocusTraversalPolicy

另请参见:
DefaultFocusTraversalPolicy, KeyboardFocusManager.setDefaultFocusTraversalPolicy(java.awt.FocusTraversalPolicy)

isFocusManagerEnabled

@Deprecated
public static boolean isFocusManagerEnabled()
已过时。  从 1.4 开始,由 KeyboardFocusManager.getDefaultFocusTraversalPolicy() 取代

返回应用程序是否已调用 disableSwingFocusManager()

另请参见:
disableSwingFocusManager()

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策