All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.im.InputContext
java.lang.Object
|
+----java.awt.im.InputContext
- public class InputContext
- extends Object
An InputContext object manages the communication between text editing
components and input methods. It dispatches events between them, and
forwards requests for information from the input method to the text
editing component. It also lets text editing components select input
methods by locale.
By default, one InputContext instance is created per Window instance,
and this input context is shared by all components within the window's
container hierarchy. However, this means that only one text input
operation is possible at any one time within a window, and that the
text needs to be committed when moving the focus from one text component
to another. If this is not desired, text components can create their
own input context instances.
- See Also:
- getInputContext, enableInputMethods
InputContext()
- Constructs an InputContext.
dispatchEvent(AWTEvent)
- Dispatches an event to the active input method.
dispose()
- Disposes of the input context and release the resources used by it.
endComposition()
- Ends any input composition that may currently be going on in this
context.
getInstance()
- Returns a new InputContext instance.
selectInputMethod(Locale)
- Selects an input method that supports the given locale.
InputContext
protected InputContext()
- Constructs an InputContext.
getInstance
public static InputContext getInstance()
- Returns a new InputContext instance.
selectInputMethod
public boolean selectInputMethod(Locale locale)
- Selects an input method that supports the given locale.
If the currently selected input method supports the desired locale
or if there's no input method available that supports the desired
locale, the current input method remains active. Otherwise, an input
method is selected that supports text input for the desired locale.
Before switching to a different input method, any currently uncommitted
text is committed.
A text editing component may call this method, for example, when
the user changes the insertion point, so that the user can
immediately continue typing in the language of the surrounding text.
- Parameters:
- locale - The desired new locale.
- Returns:
- Whether the input method that's active after this call
supports the desired locale.
dispatchEvent
public void dispatchEvent(AWTEvent event)
- Dispatches an event to the active input method. Called by AWT.
- Parameters:
- event - The event
endComposition
public void endComposition()
- Ends any input composition that may currently be going on in this
context. Depending on the platform and possibly user preferences,
this may commit or delete uncommitted text. Any changes to the text
are communicated to the active component using an input method event.
A text editing component may call this in a variety of situations,
for example, when the user moves the insertion point within the text
(but outside the composed text), or when the component's text is
saved to a file or copied to the clipboard.
dispose
public void dispose()
- Disposes of the input context and release the resources used by it.
Called by AWT.
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature