Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Interface java.awt.im.InputMethodRequests


public interface InputMethodRequests
InputMethodRequests defines the requests that a text editing component has to handle in order to work with input methods. The component can implement this interface itself or use a separate object that implements it. The object implementing this interface must be returned from the component's getInputMethodRequests method.

The text editing component also has to provide an input method event listener.

See Also:
getInputMethodRequests, InputMethodListener

Method Summary
AttributedCharacterIterator  cancelLatestCommittedText(String[] attributeNames)
Gets the latest committed text from the text editing component and removes it from the component's text body.
AttributedCharacterIterator  getCommittedText(int beginIndex, int endIndex, String[] attributeNames)
Gets an iterator providing access to the entire text and attributes contained in the text editing component except for uncommitted text.
int  getCommittedTextLength()
Gets the length of the entire text contained in the text editing component except for uncommitted (composed) text.
int  getInsertPositionOffset()
Gets the offset of the insert position in the committed text contained in the text editing component.
TextHitInfo  getLocationOffset(int x, int y)
Gets the offset within the composed text for the specified absolute x and y coordinates on the screen.
Rectangle  getOffsetLocation(TextHitInfo offset)
Gets the location of a specified offset in the current composed text.
AttributedCharacterIterator  getSelectedText(String[] attributeNames)
Gets the currently selected text from the text editing component.
 

Method Detail

getOffsetLocation

public Rectangle getOffsetLocation(TextHitInfo offset)
Gets the location of a specified offset in the current composed text. This information is, for example, used to position the candidate window near the composed text. The offset is relative to the composed text, so offset 0 indicates the beginning of the composed text. The location is represented as a 0-thickness caret, that is, it has 0 width if the text is drawn horizontally, and 0 height if the text is drawn vertically. Other text orientations need to be mapped to horizontal or vertical orientation. The rectangle uses absolute screen coordinates.
Parameters:
offset - The offset within the composed text.
Returns:
A rectangle representing the screen location of the offset.

getLocationOffset

public TextHitInfo getLocationOffset(int x,
                                     int y)
Gets the offset within the composed text for the specified absolute x and y coordinates on the screen. This information is used, for example to handle mouse clicks and the mouse cursor. The offset is relative to the composed text, so offset 0 indicates the beginning of the composed text.

Return null if the location is outside the area occupied by the composed text.

Parameters:
x - The absolute x coordinate on screen.
y - The absolute y coordinate on screen.
Returns:
Text hit info about the offset in the composed text.

getInsertPositionOffset

public int getInsertPositionOffset()
Gets the offset of the insert position in the committed text contained in the text editing component. This is the offset at which characters entered through an input method are inserted. This information is used by an input method, for example, to examine the text surrounding the insert position.
Returns:
The offset of the insert position.

getCommittedText

public AttributedCharacterIterator getCommittedText(int beginIndex,
                                                    int endIndex,
                                                    String[] attributeNames)
Gets an iterator providing access to the entire text and attributes contained in the text editing component except for uncommitted text. Uncommitted (composed) text should be ignored for index calculations and should not be made accessible through the iterator. The input method may provide a list of names of attributes that it is interested in. In that case, information about other attributes that the implementor may have need not be made accessible through the iterator. If the list is null, all available attribute information should be made accessible.
Parameters:
beginIndex - the index of the first character
endIndex - the index of the character following the last character
attributeNames - a list of attributes that the input method is interested in
Returns:
an iterator providing access to the text and its attributes

getCommittedTextLength

public int getCommittedTextLength()
Gets the length of the entire text contained in the text editing component except for uncommitted (composed) text.
Returns:
length of text

cancelLatestCommittedText

public AttributedCharacterIterator cancelLatestCommittedText(String[] attributeNames)
Gets the latest committed text from the text editing component and removes it from the component's text body. This is used for the "Undo Commit" feature in some input methods, where the committed text reverts to its previous composed state. The composed text will be sent to the component using an InputMethodEvent.

Generally, this feature should only be supported immediately after the text was committed, not after the user performed other operations on the text. When the feature is not supported, return null.

Returns:
The latest committed text, or null when the "Undo Commit" feature is not supported.

getSelectedText

public AttributedCharacterIterator getSelectedText(String[] attributeNames)
Gets the currently selected text from the text editing component. This is used for the "Reconvert" feature in some input methods. Typically, the input method will send an input method event to replace the selected text with composed text. Depending on the input method's capabilities, this may be the original composed text for the selected text, the latest composed text entered anywhere in the text, or a version of the text that's converted back from the selected text.

If a text component doesn't support this feature, return null.

Returns:
The currently selected text, or null when the "Reconvert" feature is not supported.

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
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.