Java Platform 1.2

javax.swing
Class FocusManager

java.lang.Object
  |
  +--javax.swing.FocusManager
Direct Known Subclasses:
DefaultFocusManager

public abstract class FocusManager
extends Object

Swing Focus Manager


Field Summary
static String FOCUS_MANAGER_CLASS_PROPERTY
          This property name is used to get the FocusManager implementation that should be used for a given UI
 
Constructor Summary
FocusManager()
           
 
Method Summary
static void disableSwingFocusManager()
          Disable Swing's focus manager for the calling thread's thread group.
abstract  void focusNextComponent(Component aComponent)
          Cause the focus manager to set the focus on the next focusable component You can call this method to cause the focus manager to focus the next component
abstract  void focusPreviousComponent(Component aComponent)
          Cause the focus manager to set the focus on the previous focusable component You can call this methid to cause the focus manager to focus the previous component
static FocusManager getCurrentManager()
          Return the FocusManager for the calling thread There is one FocusManager per thread group
static boolean isFocusManagerEnabled()
          Return whether Swing's focus manager is enabled
abstract  void processKeyEvent(Component focusedComponent, KeyEvent anEvent)
          This method is called by JComponents when a key event occurs.
static void setCurrentManager(FocusManager aFocusManager)
          Set the FocusManager that should be used for the calling thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOCUS_MANAGER_CLASS_PROPERTY

public static final String FOCUS_MANAGER_CLASS_PROPERTY
This property name is used to get the FocusManager implementation that should be used for a given UI
Constructor Detail

FocusManager

public FocusManager()
Method Detail

getCurrentManager

public static FocusManager getCurrentManager()
Return the FocusManager for the calling thread There is one FocusManager per thread group

setCurrentManager

public static void setCurrentManager(FocusManager aFocusManager)
Set the FocusManager that should be used for the calling thread. aFocusManager will be the default focus manager for the calling thread's thread group.

disableSwingFocusManager

public static void disableSwingFocusManager()
Disable Swing's focus manager for the calling thread's thread group. Call this method if your application mixes java.awt components and swing's components. Your application will then use the awt focus manager.

isFocusManagerEnabled

public static boolean isFocusManagerEnabled()
Return whether Swing's focus manager is enabled

processKeyEvent

public abstract void processKeyEvent(Component focusedComponent,
                                     KeyEvent anEvent)
This method is called by JComponents when a key event occurs. JComponent gives key events to the focus manager first, then to key listeners, then to the keyboard UI dispatcher. This method should look at the key event and change the focused component if the key event matches the receiver's focus manager hot keys. For example the default focus manager will change the focus if the key event matches TAB or Shift + TAB. The focus manager should call consume() on anEvent if anEvent has been processed. focusedComponent is the component that currently has the focus. Note: FocusManager will receive both KEY_PRESSED and KEY_RELEASED key events. If one event is consumed, the other one should be consumed too.

focusNextComponent

public abstract void focusNextComponent(Component aComponent)
Cause the focus manager to set the focus on the next focusable component You can call this method to cause the focus manager to focus the next component

focusPreviousComponent

public abstract void focusPreviousComponent(Component aComponent)
Cause the focus manager to set the focus on the previous focusable component You can call this methid to cause the focus manager to focus the previous component

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.