List of usage examples for java.awt.font TextHitInfo leading
public static TextHitInfo leading(int charIndex)
From source file:CodePointInputMethod.java
/** * Send the composed text to the client. *//*from w w w. ja v a 2 s .c om*/ private void sendComposedText() { AttributedString as = new AttributedString(buffer.toString()); as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT, InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT); context.dispatchInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, as.getIterator(), 0, TextHitInfo.leading(insertionPoint), null); }
From source file:CodePointInputMethod.java
/** * Send the committed text to the client. *//*w w w. j av a 2 s .c o m*/ private void sendCommittedText() { AttributedString as = new AttributedString(buffer.toString()); context.dispatchInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, as.getIterator(), buffer.length(), TextHitInfo.leading(insertionPoint), null); buffer.setLength(0); insertionPoint = 0; format = UNSET; }
From source file:CodePointInputMethod.java
/** * Move the insertion point one position to the left in the composed text. * Do not let the caret move to the left of the "\\u" or "\\U". *///www. j a v a 2s . c om private void moveCaretLeft() { int len = buffer.length(); if (--insertionPoint < 2) { insertionPoint++; beep(); } else if (format == SURROGATE_PAIR && insertionPoint == 7) { insertionPoint = 8; beep(); } context.dispatchInputMethodEvent(InputMethodEvent.CARET_POSITION_CHANGED, null, 0, TextHitInfo.leading(insertionPoint), null); }
From source file:CodePointInputMethod.java
/** * Move the insertion point one position to the right in the composed text. *///from w ww .j ava 2 s . co m private void moveCaretRight() { int len = buffer.length(); if (++insertionPoint > len) { insertionPoint = len; beep(); } context.dispatchInputMethodEvent(InputMethodEvent.CARET_POSITION_CHANGED, null, 0, TextHitInfo.leading(insertionPoint), null); }