|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--LWTextComponent | +--ActiveClient
Implements an integrated text input user interface. This class is an active client of the input method framework, that is, actively uses its APIs to accomplish integration.
This class directly implements the two client interfaces of the input method framework, InputMethodListener and InputMethodRequests. This is not required. Especially in cases where the public interface matters (such as in a class library), it may be more appropriate to hide the implementations of these two interfaces in separate classes.
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
ActiveClient(String name)
Constructs an ActiveClient. |
Method Summary | |
AttributedCharacterIterator |
cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes)
Returns null to indicate that the "Undo Commit" feature is not supported by this simple text component. |
void |
caretPositionChanged(InputMethodEvent event)
Handles changes to the caret within composed text. |
TextHitInfo |
getCaret()
Returns a text hit info indicating the current caret (insertion point). |
AttributedCharacterIterator |
getCommittedText(int beginIndex,
int endIndex,
AttributedCharacterIterator.Attribute[] attributes)
Gets an iterator providing access to the entire text and attributes contained in the text editing component except for uncommitted text. |
AttributedCharacterIterator |
getDisplayText()
Returns the text that the user has entered. |
InputMethodRequests |
getInputMethodRequests()
Implements getInputMethodRequests for ActiveClient by returning "this". |
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. |
AttributedCharacterIterator |
getSelectedText(AttributedCharacterIterator.Attribute[] attributes)
Gets the currently selected text from the text editing component. |
Rectangle |
getTextLocation(TextHitInfo offset)
Gets the location of a specified offset in the current composed text, or of the selection in committed text. |
void |
inputMethodTextChanged(InputMethodEvent event)
Handles changes to the text entered through an input method. |
void |
setFontSize(int size)
Adjusts composed text for new font size. |
Methods inherited from class LWTextComponent |
focusGained,
focusLost,
getCaretRectangle,
getCaretRectangle,
getCommittedText,
getCommittedText,
getCommittedTextLength,
getTextLayout,
getTextOrigin,
insertCharacter,
invalidateTextLayout,
keyPressed,
keyReleased,
keyTyped,
paint |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public ActiveClient(String name)
name
- the component name to be displayed above the textMethod Detail |
public InputMethodRequests getInputMethodRequests()
public void setFontSize(int size)
public AttributedCharacterIterator getDisplayText()
public TextHitInfo getCaret()
public void inputMethodTextChanged(InputMethodEvent event)
In this simple component, we only keep input method highlight attributes. Smarter components may want to keep language, reading, input method segment, and other attributes as well.
public void caretPositionChanged(InputMethodEvent event)
public Rectangle getTextLocation(TextHitInfo offset)
public TextHitInfo getLocationOffset(int x, int y)
public int getInsertPositionOffset()
public AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes)
public AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes)
public AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes)
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |