public abstract class

InputMethodManager

extends Object
java.lang.Object
   ↳ sun.awt.im.InputMethodManager

Class Overview

InputMethodManager is an abstract class that manages the input method environment of JVM. There is only one InputMethodManager instance in JVM that is executed under a separate daemon thread. InputMethodManager performs the following:

  • Keeps track of the current input context.
  • Provides a user interface to switch input methods and notifies the current input context about changes made from the user interface.
The mechanism for supporting input method switch is as follows. (Note that this may change in future releases.)
  • One way is to use platform-dependent window manager's menu (known as the Window menu in Motif and the System menu or Control menu in Win32) on each window which is popped up by clicking the left top box of a window (known as Window menu button in Motif and System menu button in Win32). This happens to be common in both Motif and Win32.
  • When more than one input method descriptor can be found or the only input method descriptor found supports multiple locales, a menu item is added to the window (manager) menu. This item label is obtained invoking getTriggerMenuString(). If null is returned by this method, it means that there is only input method or none in the environment. Frame and Dialog invoke this method.
  • This menu item means a trigger switch to the user to pop up a selection menu.
  • When the menu item of the window (manager) menu has been selected by the user, Frame/Dialog invokes notifyChangeRequest() to notify InputMethodManager that the user wants to switch input methods.
  • InputMethodManager displays a pop-up menu to choose an input method.
  • InputMethodManager notifies the current InputContext of the selected InputMethod.
  • The other way is to use user-defined hot key combination to show the pop-up menu to choose an input method. This is useful for the platforms which do not provide a way to add a menu item in the window (manager) menu.
  • When the hot key combination is typed by the user, the component which has the input focus invokes notifyChangeRequestByHotKey() to notify InputMethodManager that the user wants to switch input methods.
  • This results in a popup menu and notification to the current input context, as above.

Summary

Public Constructors
InputMethodManager()
Public Methods
final static InputMethodManager getInstance()
Returns the instance of InputMethodManager.
abstract String getTriggerMenuString()
Gets a string for the trigger menu item that should be added to the window manager menu.
abstract void notifyChangeRequest(Component comp)
Notifies InputMethodManager that input method change has been requested by the user.
abstract void notifyChangeRequestByHotKey(Component comp)
Notifies InputMethodManager that input method change has been requested by the user using the hot key combination.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public InputMethodManager ()

Public Methods

public static final InputMethodManager getInstance ()

Returns the instance of InputMethodManager. This method creates the instance that is unique in the Java VM if it has not been created yet.

Returns
  • the InputMethodManager instance

public abstract String getTriggerMenuString ()

Gets a string for the trigger menu item that should be added to the window manager menu. If no need to display the trigger menu item, null is returned.

public abstract void notifyChangeRequest (Component comp)

Notifies InputMethodManager that input method change has been requested by the user. This notification triggers a popup menu for user selection.

Parameters
comp Component that has accepted the change request. This component has to be a Frame or Dialog.

public abstract void notifyChangeRequestByHotKey (Component comp)

Notifies InputMethodManager that input method change has been requested by the user using the hot key combination. This notification triggers a popup menu for user selection.

Parameters
comp Component that has accepted the change request. This component has the input focus.