APIdia Launch Partner
Top Description Fields Constructors Methods
sun.awt.im

public Class InputMethodContext

extends InputContext
implements InputMethodContext
Class Inheritance
All Implemented Interfaces
java.awt.im.spi.InputMethodContext, java.awt.im.InputMethodRequests
Imports
java.awt.AWTEvent, .Component, .GraphicsEnvironment, .HeadlessException, .Rectangle, .Toolkit, .Window, java.awt.event.KeyEvent, .InputMethodEvent, java.awt.font.TextHitInfo, java.awt.im.InputMethodRequests, java.awt.im.spi.InputMethod, java.text.AttributedCharacterIterator, .AttributedCharacterIterator.Attribute, .AttributedString, .CharacterIterator, javax.swing.JFrame, sun.awt.InputMethodSupport

The InputMethodContext class provides methods that input methods can use to communicate with their client components. It is a subclass of InputContext, which provides methods for use by components.
Author
JavaSoft International

Field Summary

Modifier and TypeField and Description
private static boolean
private CompositionAreaHandler
private Object
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public
InputMethodContext()

Constructs an InputMethodContext.

Method Summary

Modifier and TypeMethod and Description
public AttributedCharacterIterator
cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes)

Implements java.awt.im.InputMethodRequests.cancelLatestCommittedText.

Calls the current client component's implementation of cancelLatestCommittedText.

public JFrame
createInputMethodJFrame(String title, boolean attachToInputContext)

Implements java.awt.im.spi.InputMethodContext.createInputMethodJFrame.

Creates a top-level Swing JFrame for use by the input method.

public Window
createInputMethodWindow(String title, boolean attachToInputContext)

Implements java.awt.im.spi.InputMethodContext.createInputMethodWindow.

Creates a top-level window for use by the input method.

pack-priv static Window
createInputMethodWindow(String title, InputContext context, boolean isSwing)

pack-priv synchronized void
dispatchCommittedText(Component
The component that the text should get dispatched to.
client
,
AttributedCharacterIterator
The iterator providing access to the committed (and possible composed) text.
text
,
int
The number of committed characters in the text.
committedCharacterCount
)

Dispatches committed text to a client component.

public void
dispatchEvent(AWTEvent event)

Overrides sun.awt.im.InputContext.dispatchEvent.

Dispatches an event to the active input method.

public void
dispatchInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)

Implements java.awt.im.spi.InputMethodContext.dispatchInputMethodEvent.

Creates an input method event from the arguments given and dispatches it to the client component.

public void
enableClientWindowNotification(InputMethod inputMethod, boolean enable)

Overrides sun.awt.im.InputContext.enableClientWindowNotification.

Implements java.awt.im.spi.InputMethodContext.enableClientWindowNotification.

Enables or disables notification of the current client window's location and state for the specified input method.

public AttributedCharacterIterator
getCommittedText(int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes)

Implements java.awt.im.InputMethodRequests.getCommittedText.

Calls the current client component's implementation of getCommittedText.

public int
getCommittedTextLength()

Implements java.awt.im.InputMethodRequests.getCommittedTextLength.

Calls the current client component's implementation of getCommittedTextLength.

private CompositionAreaHandler
getCompositionAreaHandler(boolean grab)

Gets this context's composition area handler, creating it if necessary.

public int
getInsertPositionOffset()

Implements java.awt.im.InputMethodRequests.getInsertPositionOffset.

Calls the current client component's implementation of getInsertPositionOffset.

public TextHitInfo
getLocationOffset(int x, int y)

Implements java.awt.im.InputMethodRequests.getLocationOffset.

Calls the current client component's implementation of getLocationOffset.

private InputMethodRequests
public AttributedCharacterIterator
getSelectedText(AttributedCharacterIterator.Attribute[] attributes)

Implements java.awt.im.InputMethodRequests.getSelectedText.

Calls the current client component's implementation of getSelectedText.

public Rectangle
getTextLocation(TextHitInfo offset)

Implements java.awt.im.InputMethodRequests.getTextLocation.

Calls the current client component's implementation of getTextLocation.

pack-priv void
grabCompositionArea(boolean doUpdate)

Grabs the composition area for use by this context.

private boolean
pack-priv boolean
isCompositionAreaVisible()

Calls CompositionAreaHandler.isCompositionAreaVisible() to see whether the composition area is visible or not.

pack-priv void
releaseCompositionArea()

Releases and closes the composition area if it is currently owned by this context's composition area handler.

pack-priv void
setCompositionAreaUndecorated(boolean undecorated)

Disables or enables decorations for the composition window.

pack-priv void
setCompositionAreaVisible(boolean visible)

Calls CompositionAreaHandler.setCompositionAreaVisible to show or hide the composition area.

pack-priv void
pack-priv boolean
Inherited from sun.awt.im.InputContext:
changeInputMethodcomponentHiddencomponentMovedcomponentResizedcomponentShowndisableNativeIMdisposeendCompositiongetClientComponentgetComponentWindowgetInputMethodControlObjectgetInputMethodInfogetInputMethodLocatorgetLocaleisCompositionEnabledreconvertremoveNotifyselectInputMethodsetCharacterSubsetssetCompositionEnabledwindowActivatedwindowClosedwindowClosingwindowDeactivatedwindowDeiconifiedwindowIconifiedwindowOpened

Field Detail

belowTheSpotInputRequestedback to summary
private static boolean belowTheSpotInputRequested
compositionAreaHandlerback to summary
private CompositionAreaHandler compositionAreaHandler
compositionAreaHandlerLockback to summary
private Object compositionAreaHandlerLock
dispatchingCommittedTextback to summary
private boolean dispatchingCommittedText
inputMethodSupportsBelowTheSpotback to summary
private boolean inputMethodSupportsBelowTheSpot

Constructor Detail

InputMethodContextback to summary
public InputMethodContext()

Constructs an InputMethodContext.

Method Detail

cancelLatestCommittedTextback to summary
public AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes)

Implements java.awt.im.InputMethodRequests.cancelLatestCommittedText.

Calls the current client component's implementation of cancelLatestCommittedText.

createInputMethodJFrameback to summary
public JFrame createInputMethodJFrame(String title, boolean attachToInputContext)

Implements java.awt.im.spi.InputMethodContext.createInputMethodJFrame.

Doc from java.awt.im.spi.InputMethodContext.createInputMethodJFrame.

Creates a top-level Swing JFrame for use by the input method. The intended behavior of this window is:

  • it floats above all document windows and dialogs
  • it and all components that it contains do not receive the focus
  • it has lightweight decorations, such as a reduced drag region without title
However, the actual behavior with respect to these three items is platform dependent.

The title may or may not be displayed, depending on the actual type of window created.

If attachToInputContext is true, the new window will share the input context that corresponds to this input method context, so that events for components in the window are automatically dispatched to the input method. Also, when the window is opened using setVisible(true), the input context will prevent deactivate and activate calls to the input method that might otherwise be caused.

Input methods must call Window.dispose on the returned input method window when it is no longer needed.

createInputMethodWindowback to summary
public Window createInputMethodWindow(String title, boolean attachToInputContext)

Implements java.awt.im.spi.InputMethodContext.createInputMethodWindow.

Doc from java.awt.im.spi.InputMethodContext.createInputMethodWindow.

Creates a top-level window for use by the input method. The intended behavior of this window is:

  • it floats above all document windows and dialogs
  • it and all components that it contains do not receive the focus
  • it has lightweight decorations, such as a reduced drag region without title
However, the actual behavior with respect to these three items is platform dependent.

The title may or may not be displayed, depending on the actual type of window created.

If attachToInputContext is true, the new window will share the input context that corresponds to this input method context, so that events for components in the window are automatically dispatched to the input method. Also, when the window is opened using setVisible(true), the input context will prevent deactivate and activate calls to the input method that might otherwise be caused.

Input methods must call Window.dispose on the returned input method window when it is no longer needed.

createInputMethodWindowback to summary
pack-priv static Window createInputMethodWindow(String title, InputContext context, boolean isSwing)
dispatchCommittedTextback to summary
pack-priv synchronized void dispatchCommittedText(Component client, AttributedCharacterIterator text, int committedCharacterCount)

Dispatches committed text to a client component. Called by composition window.

Parameters
client:Component

The component that the text should get dispatched to.

text:AttributedCharacterIterator

The iterator providing access to the committed (and possible composed) text.

committedCharacterCount:int

The number of committed characters in the text.

dispatchEventback to summary
public void dispatchEvent(AWTEvent event)

Overrides sun.awt.im.InputContext.dispatchEvent.

Doc from java.awt.im.InputContext.dispatchEvent.

Dispatches an event to the active input method. Called by AWT. If no input method is available, then the event will never be consumed.

dispatchInputMethodEventback to summary
public void dispatchInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)

Implements java.awt.im.spi.InputMethodContext.dispatchInputMethodEvent.

Doc from java.awt.im.spi.InputMethodContext.dispatchInputMethodEvent.

Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see java.awt.event.InputMethodEvent#InputMethodEvent.

enableClientWindowNotificationback to summary
public void enableClientWindowNotification(InputMethod inputMethod, boolean enable)

Overrides sun.awt.im.InputContext.enableClientWindowNotification.

Implements java.awt.im.spi.InputMethodContext.enableClientWindowNotification.

Doc from java.awt.im.spi.InputMethodContext.enableClientWindowNotification.

Enables or disables notification of the current client window's location and state for the specified input method. When notification is enabled, the input method's notifyClientWindowChange method is called as described in that method's specification. Notification is automatically disabled when the input method is disposed.

See Also
java.awt.im.spi.InputMethodContext#enableClientWindowNotification
getCommittedTextback to summary
public AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes)

Implements java.awt.im.InputMethodRequests.getCommittedText.

Calls the current client component's implementation of getCommittedText.

getCommittedTextLengthback to summary
public int getCommittedTextLength()

Implements java.awt.im.InputMethodRequests.getCommittedTextLength.

Calls the current client component's implementation of getCommittedTextLength.

getCompositionAreaHandlerback to summary
private CompositionAreaHandler getCompositionAreaHandler(boolean grab)

Gets this context's composition area handler, creating it if necessary. If requested, it grabs the composition area for use by this context. The composition area's text is not updated.

getInsertPositionOffsetback to summary
public int getInsertPositionOffset()

Implements java.awt.im.InputMethodRequests.getInsertPositionOffset.

Calls the current client component's implementation of getInsertPositionOffset.

getLocationOffsetback to summary
public TextHitInfo getLocationOffset(int x, int y)

Implements java.awt.im.InputMethodRequests.getLocationOffset.

Calls the current client component's implementation of getLocationOffset.

getReqback to summary
private InputMethodRequests getReq()
getSelectedTextback to summary
public AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes)

Implements java.awt.im.InputMethodRequests.getSelectedText.

Calls the current client component's implementation of getSelectedText.

getTextLocationback to summary
public Rectangle getTextLocation(TextHitInfo offset)

Implements java.awt.im.InputMethodRequests.getTextLocation.

Calls the current client component's implementation of getTextLocation.

grabCompositionAreaback to summary
pack-priv void grabCompositionArea(boolean doUpdate)

Grabs the composition area for use by this context. If doUpdate is true, updates the composition area with previously sent composed text.

haveActiveClientback to summary
private boolean haveActiveClient()
isCompositionAreaVisibleback to summary
pack-priv boolean isCompositionAreaVisible()

Calls CompositionAreaHandler.isCompositionAreaVisible() to see whether the composition area is visible or not. Notice that this method is always called on the AWT event dispatch thread.

releaseCompositionAreaback to summary
pack-priv void releaseCompositionArea()

Releases and closes the composition area if it is currently owned by this context's composition area handler.

setCompositionAreaUndecoratedback to summary
pack-priv void setCompositionAreaUndecorated(boolean undecorated)

Disables or enables decorations for the composition window.

setCompositionAreaVisibleback to summary
pack-priv void setCompositionAreaVisible(boolean visible)

Calls CompositionAreaHandler.setCompositionAreaVisible to show or hide the composition area. As isCompositionAreaVisible method, it is always called on AWT event dispatch thread.

setInputMethodSupportsBelowTheSpotback to summary
pack-priv void setInputMethodSupportsBelowTheSpot(boolean supported)
useBelowTheSpotInputback to summary
pack-priv boolean useBelowTheSpotInput()