< prev index next >

src/java.desktop/share/classes/java/awt/event/InputMethodEvent.java

Print this page

        

*** 104,152 **** private transient int committedCharacterCount; private transient TextHitInfo caret; private transient TextHitInfo visiblePosition; /** ! * Constructs an <code>InputMethodEvent</code> with the specified * source component, type, time, text, caret, and visiblePosition. * <p> * The offsets of caret and visiblePosition are relative to the current ! * composed text; that is, the composed text within <code>text</code> ! * if this is an <code>INPUT_METHOD_TEXT_CHANGED</code> event, ! * the composed text within the <code>text</code> of the ! * preceding <code>INPUT_METHOD_TEXT_CHANGED</code> event otherwise. ! * <p>Note that passing in an invalid <code>id</code> results in * unspecified behavior. This method throws an ! * <code>IllegalArgumentException</code> if <code>source</code> ! * is <code>null</code>. * * @param source the object where the event originated * @param id the event type * @param when a long integer that specifies the time the event occurred * @param text the combined committed and composed text, ! * committed text first; must be <code>null</code> ! * when the event type is <code>CARET_POSITION_CHANGED</code>; ! * may be <code>null</code> for ! * <code>INPUT_METHOD_TEXT_CHANGED</code> if there's no * committed or composed text * @param committedCharacterCount the number of committed * characters in the text * @param caret the caret (a.k.a. insertion point); ! * <code>null</code> if there's no caret within current * composed text * @param visiblePosition the position that's most important ! * to be visible; <code>null</code> if there's no * recommendation for a visible position within current * composed text ! * @throws IllegalArgumentException if <code>id</code> is not * in the range ! * <code>INPUT_METHOD_FIRST</code>..<code>INPUT_METHOD_LAST</code>; ! * or if id is <code>CARET_POSITION_CHANGED</code> and ! * <code>text</code> is not <code>null</code>; ! * or if <code>committedCharacterCount</code> is not in the range ! * <code>0</code>..<code>(text.getEndIndex() - text.getBeginIndex())</code> ! * @throws IllegalArgumentException if <code>source</code> is null * * @since 1.4 */ public InputMethodEvent(Component source, int id, long when, AttributedCharacterIterator text, int committedCharacterCount, --- 104,152 ---- private transient int committedCharacterCount; private transient TextHitInfo caret; private transient TextHitInfo visiblePosition; /** ! * Constructs an {@code InputMethodEvent} with the specified * source component, type, time, text, caret, and visiblePosition. * <p> * The offsets of caret and visiblePosition are relative to the current ! * composed text; that is, the composed text within {@code text} ! * if this is an {@code INPUT_METHOD_TEXT_CHANGED} event, ! * the composed text within the {@code text} of the ! * preceding {@code INPUT_METHOD_TEXT_CHANGED} event otherwise. ! * <p>Note that passing in an invalid {@code id} results in * unspecified behavior. This method throws an ! * {@code IllegalArgumentException} if {@code source} ! * is {@code null}. * * @param source the object where the event originated * @param id the event type * @param when a long integer that specifies the time the event occurred * @param text the combined committed and composed text, ! * committed text first; must be {@code null} ! * when the event type is {@code CARET_POSITION_CHANGED}; ! * may be {@code null} for ! * {@code INPUT_METHOD_TEXT_CHANGED} if there's no * committed or composed text * @param committedCharacterCount the number of committed * characters in the text * @param caret the caret (a.k.a. insertion point); ! * {@code null} if there's no caret within current * composed text * @param visiblePosition the position that's most important ! * to be visible; {@code null} if there's no * recommendation for a visible position within current * composed text ! * @throws IllegalArgumentException if {@code id} is not * in the range ! * {@code INPUT_METHOD_FIRST}..{@code INPUT_METHOD_LAST}; ! * or if id is {@code CARET_POSITION_CHANGED} and ! * {@code text} is not {@code null}; ! * or if {@code committedCharacterCount} is not in the range ! * {@code 0}..{@code (text.getEndIndex() - text.getBeginIndex())} ! * @throws IllegalArgumentException if {@code source} is null * * @since 1.4 */ public InputMethodEvent(Component source, int id, long when, AttributedCharacterIterator text, int committedCharacterCount,
*** 175,224 **** this.caret = caret; this.visiblePosition = visiblePosition; } /** ! * Constructs an <code>InputMethodEvent</code> with the specified * source component, type, text, caret, and visiblePosition. * <p> * The offsets of caret and visiblePosition are relative to the current ! * composed text; that is, the composed text within <code>text</code> ! * if this is an <code>INPUT_METHOD_TEXT_CHANGED</code> event, ! * the composed text within the <code>text</code> of the ! * preceding <code>INPUT_METHOD_TEXT_CHANGED</code> event otherwise. * The time stamp for this event is initialized by invoking * {@link java.awt.EventQueue#getMostRecentEventTime()}. ! * <p>Note that passing in an invalid <code>id</code> results in * unspecified behavior. This method throws an ! * <code>IllegalArgumentException</code> if <code>source</code> ! * is <code>null</code>. * * @param source the object where the event originated * @param id the event type * @param text the combined committed and composed text, ! * committed text first; must be <code>null</code> ! * when the event type is <code>CARET_POSITION_CHANGED</code>; ! * may be <code>null</code> for ! * <code>INPUT_METHOD_TEXT_CHANGED</code> if there's no * committed or composed text * @param committedCharacterCount the number of committed * characters in the text * @param caret the caret (a.k.a. insertion point); ! * <code>null</code> if there's no caret within current * composed text * @param visiblePosition the position that's most important ! * to be visible; <code>null</code> if there's no * recommendation for a visible position within current * composed text ! * @throws IllegalArgumentException if <code>id</code> is not * in the range ! * <code>INPUT_METHOD_FIRST</code>..<code>INPUT_METHOD_LAST</code>; ! * or if id is <code>CARET_POSITION_CHANGED</code> and ! * <code>text</code> is not <code>null</code>; ! * or if <code>committedCharacterCount</code> is not in the range ! * <code>0</code>..<code>(text.getEndIndex() - text.getBeginIndex())</code> ! * @throws IllegalArgumentException if <code>source</code> is null */ public InputMethodEvent(Component source, int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition) { this(source, id, --- 175,224 ---- this.caret = caret; this.visiblePosition = visiblePosition; } /** ! * Constructs an {@code InputMethodEvent} with the specified * source component, type, text, caret, and visiblePosition. * <p> * The offsets of caret and visiblePosition are relative to the current ! * composed text; that is, the composed text within {@code text} ! * if this is an {@code INPUT_METHOD_TEXT_CHANGED} event, ! * the composed text within the {@code text} of the ! * preceding {@code INPUT_METHOD_TEXT_CHANGED} event otherwise. * The time stamp for this event is initialized by invoking * {@link java.awt.EventQueue#getMostRecentEventTime()}. ! * <p>Note that passing in an invalid {@code id} results in * unspecified behavior. This method throws an ! * {@code IllegalArgumentException} if {@code source} ! * is {@code null}. * * @param source the object where the event originated * @param id the event type * @param text the combined committed and composed text, ! * committed text first; must be {@code null} ! * when the event type is {@code CARET_POSITION_CHANGED}; ! * may be {@code null} for ! * {@code INPUT_METHOD_TEXT_CHANGED} if there's no * committed or composed text * @param committedCharacterCount the number of committed * characters in the text * @param caret the caret (a.k.a. insertion point); ! * {@code null} if there's no caret within current * composed text * @param visiblePosition the position that's most important ! * to be visible; {@code null} if there's no * recommendation for a visible position within current * composed text ! * @throws IllegalArgumentException if {@code id} is not * in the range ! * {@code INPUT_METHOD_FIRST}..{@code INPUT_METHOD_LAST}; ! * or if id is {@code CARET_POSITION_CHANGED} and ! * {@code text} is not {@code null}; ! * or if {@code committedCharacterCount} is not in the range ! * {@code 0}..{@code (text.getEndIndex() - text.getBeginIndex())} ! * @throws IllegalArgumentException if {@code source} is null */ public InputMethodEvent(Component source, int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition) { this(source, id,
*** 226,279 **** text, committedCharacterCount, caret, visiblePosition); } /** ! * Constructs an <code>InputMethodEvent</code> with the * specified source component, type, caret, and visiblePosition. ! * The text is set to <code>null</code>, ! * <code>committedCharacterCount</code> to 0. * <p> ! * The offsets of <code>caret</code> and <code>visiblePosition</code> * are relative to the current composed text; that is, ! * the composed text within the <code>text</code> of the ! * preceding <code>INPUT_METHOD_TEXT_CHANGED</code> event if the ! * event being constructed as a <code>CARET_POSITION_CHANGED</code> event. ! * For an <code>INPUT_METHOD_TEXT_CHANGED</code> event without text, ! * <code>caret</code> and <code>visiblePosition</code> must be ! * <code>null</code>. * The time stamp for this event is initialized by invoking * {@link java.awt.EventQueue#getMostRecentEventTime()}. ! * <p>Note that passing in an invalid <code>id</code> results in * unspecified behavior. This method throws an ! * <code>IllegalArgumentException</code> if <code>source</code> ! * is <code>null</code>. * * @param source the object where the event originated * @param id the event type * @param caret the caret (a.k.a. insertion point); ! * <code>null</code> if there's no caret within current * composed text * @param visiblePosition the position that's most important ! * to be visible; <code>null</code> if there's no * recommendation for a visible position within current * composed text ! * @throws IllegalArgumentException if <code>id</code> is not * in the range ! * <code>INPUT_METHOD_FIRST</code>..<code>INPUT_METHOD_LAST</code> ! * @throws IllegalArgumentException if <code>source</code> is null */ public InputMethodEvent(Component source, int id, TextHitInfo caret, TextHitInfo visiblePosition) { this(source, id, getMostRecentEventTimeForSource(source), null, 0, caret, visiblePosition); } /** * Gets the combined committed and composed text. ! * Characters from index 0 to index <code>getCommittedCharacterCount() - 1</code> are committed * text, the remaining characters are composed text. * * @return the text. * Always null for CARET_POSITION_CHANGED; * may be null for INPUT_METHOD_TEXT_CHANGED if there's no composed or committed text. --- 226,279 ---- text, committedCharacterCount, caret, visiblePosition); } /** ! * Constructs an {@code InputMethodEvent} with the * specified source component, type, caret, and visiblePosition. ! * The text is set to {@code null}, ! * {@code committedCharacterCount} to 0. * <p> ! * The offsets of {@code caret} and {@code visiblePosition} * are relative to the current composed text; that is, ! * the composed text within the {@code text} of the ! * preceding {@code INPUT_METHOD_TEXT_CHANGED} event if the ! * event being constructed as a {@code CARET_POSITION_CHANGED} event. ! * For an {@code INPUT_METHOD_TEXT_CHANGED} event without text, ! * {@code caret} and {@code visiblePosition} must be ! * {@code null}. * The time stamp for this event is initialized by invoking * {@link java.awt.EventQueue#getMostRecentEventTime()}. ! * <p>Note that passing in an invalid {@code id} results in * unspecified behavior. This method throws an ! * {@code IllegalArgumentException} if {@code source} ! * is {@code null}. * * @param source the object where the event originated * @param id the event type * @param caret the caret (a.k.a. insertion point); ! * {@code null} if there's no caret within current * composed text * @param visiblePosition the position that's most important ! * to be visible; {@code null} if there's no * recommendation for a visible position within current * composed text ! * @throws IllegalArgumentException if {@code id} is not * in the range ! * {@code INPUT_METHOD_FIRST}..{@code INPUT_METHOD_LAST} ! * @throws IllegalArgumentException if {@code source} is null */ public InputMethodEvent(Component source, int id, TextHitInfo caret, TextHitInfo visiblePosition) { this(source, id, getMostRecentEventTimeForSource(source), null, 0, caret, visiblePosition); } /** * Gets the combined committed and composed text. ! * Characters from index 0 to index {@code getCommittedCharacterCount() - 1} are committed * text, the remaining characters are composed text. * * @return the text. * Always null for CARET_POSITION_CHANGED; * may be null for INPUT_METHOD_TEXT_CHANGED if there's no composed or committed text.
*** 293,305 **** /** * Gets the caret. * <p> * The offset of the caret is relative to the current * composed text; that is, the composed text within getText() ! * if this is an <code>INPUT_METHOD_TEXT_CHANGED</code> event, * the composed text within getText() of the ! * preceding <code>INPUT_METHOD_TEXT_CHANGED</code> event otherwise. * * @return the caret (a.k.a. insertion point). * Null if there's no caret within current composed text. */ public TextHitInfo getCaret() { --- 293,305 ---- /** * Gets the caret. * <p> * The offset of the caret is relative to the current * composed text; that is, the composed text within getText() ! * if this is an {@code INPUT_METHOD_TEXT_CHANGED} event, * the composed text within getText() of the ! * preceding {@code INPUT_METHOD_TEXT_CHANGED} event otherwise. * * @return the caret (a.k.a. insertion point). * Null if there's no caret within current composed text. */ public TextHitInfo getCaret() {
*** 309,321 **** /** * Gets the position that's most important to be visible. * <p> * The offset of the visible position is relative to the current * composed text; that is, the composed text within getText() ! * if this is an <code>INPUT_METHOD_TEXT_CHANGED</code> event, * the composed text within getText() of the ! * preceding <code>INPUT_METHOD_TEXT_CHANGED</code> event otherwise. * * @return the position that's most important to be visible. * Null if there's no recommendation for a visible position within current composed text. */ public TextHitInfo getVisiblePosition() { --- 309,321 ---- /** * Gets the position that's most important to be visible. * <p> * The offset of the visible position is relative to the current * composed text; that is, the composed text within getText() ! * if this is an {@code INPUT_METHOD_TEXT_CHANGED} event, * the composed text within getText() of the ! * preceding {@code INPUT_METHOD_TEXT_CHANGED} event otherwise. * * @return the position that's most important to be visible. * Null if there's no recommendation for a visible position within current composed text. */ public TextHitInfo getVisiblePosition() {
*** 409,419 **** return typeStr + ", " + textString + ", " + countString + ", " + caretString + ", " + visiblePositionString; } /** ! * Initializes the <code>when</code> field if it is not present in the * object input stream. In that case, the field will be initialized by * invoking {@link java.awt.EventQueue#getMostRecentEventTime()}. */ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { s.defaultReadObject(); --- 409,419 ---- return typeStr + ", " + textString + ", " + countString + ", " + caretString + ", " + visiblePositionString; } /** ! * Initializes the {@code when} field if it is not present in the * object input stream. In that case, the field will be initialized by * invoking {@link java.awt.EventQueue#getMostRecentEventTime()}. */ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { s.defaultReadObject();
< prev index next >