GeezerVison is showing docs.oracle.com — InputContext (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
java.awt.im
Class InputContext
-
-
Constructor Summary
Constructors
| Modifier |
Constructor |
Description |
protected |
InputContext() |
Constructs an InputContext.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
void |
dispatchEvent(AWTEvent event) |
Dispatches an event to the active input method.
|
void |
dispose() |
Releases the resources used by this input context.
|
void |
endComposition() |
Ends any input composition that may currently be going on in this
context.
|
Object |
getInputMethodControlObject() |
Returns a control object from the current input method, or null.
|
static InputContext |
getInstance() |
Returns a new InputContext instance.
|
Locale |
getLocale() |
Returns the current locale of the current input method or keyboard
layout.
|
boolean |
isCompositionEnabled() |
Determines whether the current input method is enabled for composition.
|
void |
reconvert() |
Asks the current input method to reconvert text from the
current client component.
|
void |
removeNotify(Component client) |
Notifies the input context that a client component has been
removed from its containment hierarchy, or that input method
support has been disabled for the component.
|
boolean |
selectInputMethod(Locale locale) |
Attempts to select an input method or keyboard layout that
supports the given locale, and returns a value indicating whether such
an input method or keyboard layout has been successfully selected.
|
void |
setCharacterSubsets(Character.Subset[] subsets) |
Sets the subsets of the Unicode character set that input methods of this input
context should be allowed to input.
|
void |
setCompositionEnabled(boolean enable) |
Enables or disables the current input method for composition,
depending on the value of the parameter enable.
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
InputContext
protected InputContext()
Constructs an InputContext.
This method is protected so clients cannot instantiate
InputContext directly. Input contexts are obtained by
calling getInstance().
-
Method Detail
-
setCharacterSubsets
public void setCharacterSubsets(Character.Subset[] subsets)
Sets the subsets of the Unicode character set that input methods of this input
context should be allowed to input. Null may be passed in to
indicate that all characters are allowed. The initial value
is null. The setting applies to the current input method as well
as input methods selected after this call is made. However,
applications cannot rely on this call having the desired effect,
since this setting cannot be passed on to all host input methods -
applications still need to apply their own character validation.
If no input methods are available, then this method has no effect.
- Parameters:
subsets - The subsets of the Unicode character set from which characters may be input
-
isCompositionEnabled
public boolean isCompositionEnabled()
Determines whether the current input method is enabled for composition.
An input method that is enabled for composition interprets incoming
events for both composition and control purposes, while a
disabled input method does not interpret events for composition.
- Returns:
true if the current input method is enabled for
composition; false otherwise
- Throws:
UnsupportedOperationException - if there is no current input
method available or the current input method does not support
checking whether it is enabled for composition
- Since:
- 1.3
- See Also:
setCompositionEnabled(boolean)
-
reconvert
public void reconvert()
Asks the current input method to reconvert text from the
current client component. The input method obtains the text to
be reconverted from the client component using the
InputMethodRequests.getSelectedText
method. The other InputMethodRequests methods
must be prepared to deal with further information requests by
the input method. The composed and/or committed text will be
sent to the client component as a sequence of
InputMethodEvents. If the input method cannot
reconvert the given text, the text is returned as committed
text in an InputMethodEvent.
- Throws:
UnsupportedOperationException - if there is no current input
method available or the current input method does not support
the reconversion operation.
- Since:
- 1.3
-
dispatchEvent
public void dispatchEvent(AWTEvent event)
Dispatches an event to the active input method. Called by AWT.
If no input method is available, then the event will never be consumed.
- Parameters:
event - The event
- Throws:
NullPointerException - if event is null
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|