Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
Sample
Document
Class java.awt.event.InputMethodEvent
Inherited members: ShowHide
Deprecated: ShowHide
View: ClientSubclassPackageImplementation
java.awt.event

Class InputMethodEvent

  • java.lang.Object
    • java.util.EventObject
      • java.awt.AWTEvent
        • java.awt.event.InputMethodEvent
  • All Implemented Interfaces:
    java.io.Serializable
    public class InputMethodEvent extends AWTEvent
    Input method events contain information about text that is being composed using an input method. Whenever the text changes, the input method sends an event. If the text component that's currently using the input method is an active client, the event is dispatched to that component. Otherwise, it is dispatched to a separate composition window.

    The text included with the input method event consists of two parts: committed text and composed text. Either part may be empty. The two parts together replace any uncommitted composed text sent in previous events, or the currently selected committed text. Committed text should be integrated into the text component's persistent data, it will not be sent again. Composed text may be sent repeatedly, with changes to reflect the user's editing operations. Committed text always precedes composed text.

    Since:
    1.2
    See Also:
    Serialized Form
    • Fields 
      Modifier and Type Field and Description
      Inherited member indicator ACTION_EVENT_MASK Reveal DetailHide Detail
      static long ACTION_EVENT_MASK
      The event mask for selecting action events.
      public static final long ACTION_EVENT_MASK
      The event mask for selecting action events.
      See Also:
      Constant Field Values
      Inherited member indicator ADJUSTMENT_EVENT_MASK Reveal DetailHide Detail
      static long ADJUSTMENT_EVENT_MASK
      The event mask for selecting adjustment events.
      public static final long ADJUSTMENT_EVENT_MASK
      The event mask for selecting adjustment events.
      See Also:
      Constant Field Values
      Ordinary member indicator CARET_POSITION_CHANGED Reveal DetailHide Detail
      static int CARET_POSITION_CHANGED
      The event type indicating a changed insertion point in input method text.
      public static final int CARET_POSITION_CHANGED
      The event type indicating a changed insertion point in input method text. This event is generated by input methods while processing input if only the caret changed.
      See Also:
      Constant Field Values
      Inherited member indicator COMPONENT_EVENT_MASK Reveal DetailHide Detail
      static long COMPONENT_EVENT_MASK
      The event mask for selecting component events.
      public static final long COMPONENT_EVENT_MASK
      The event mask for selecting component events.
      See Also:
      Constant Field Values
      Inherited member indicator consumed Reveal DetailHide Detail
      protected boolean consumed
      Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not.
      protected boolean consumed
      Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not. Semantic events always have a 'true' value since they were generated by the peer in response to a low-level event.
      See Also:
      AWTEvent.consume(), AWTEvent.isConsumed()
      Inherited member indicator CONTAINER_EVENT_MASK Reveal DetailHide Detail
      static long CONTAINER_EVENT_MASK
      The event mask for selecting container events.
      public static final long CONTAINER_EVENT_MASK
      The event mask for selecting container events.
      See Also:
      Constant Field Values
      Inherited member indicator FOCUS_EVENT_MASK Reveal DetailHide Detail
      static long FOCUS_EVENT_MASK
      The event mask for selecting focus events.
      public static final long FOCUS_EVENT_MASK
      The event mask for selecting focus events.
      See Also:
      Constant Field Values
      Inherited member indicator HIERARCHY_BOUNDS_EVENT_MASK Reveal DetailHide Detail
      static long HIERARCHY_BOUNDS_EVENT_MASK
      The event mask for selecting hierarchy bounds events.
      public static final long HIERARCHY_BOUNDS_EVENT_MASK
      The event mask for selecting hierarchy bounds events.
      See Also:
      Constant Field Values
      Inherited member indicator HIERARCHY_EVENT_MASK Reveal DetailHide Detail
      static long HIERARCHY_EVENT_MASK
      The event mask for selecting hierarchy events.
      public static final long HIERARCHY_EVENT_MASK
      The event mask for selecting hierarchy events.
      See Also:
      Constant Field Values
      Inherited member indicator id Reveal DetailHide Detail
      protected int id
      The event's id.
      protected int id
      The event's id.
      See Also:
      AWTEvent.getID(), AWTEvent.AWTEvent(java.lang.Object, int)
      Inherited member indicator INPUT_METHOD_EVENT_MASK Reveal DetailHide Detail
      static long INPUT_METHOD_EVENT_MASK
      The event mask for selecting input method events.
      public static final long INPUT_METHOD_EVENT_MASK
      The event mask for selecting input method events.
      See Also:
      Constant Field Values
      Ordinary member indicator INPUT_METHOD_FIRST Reveal DetailHide Detail
      static int INPUT_METHOD_FIRST
      Marks the first integer id for the range of input method event ids.
      public static final int INPUT_METHOD_FIRST
      Marks the first integer id for the range of input method event ids.
      See Also:
      Constant Field Values
      Ordinary member indicator INPUT_METHOD_LAST Reveal DetailHide Detail
      static int INPUT_METHOD_LAST
      Marks the last integer id for the range of input method event ids.
      public static final int INPUT_METHOD_LAST
      Marks the last integer id for the range of input method event ids.
      See Also:
      Constant Field Values
      Ordinary member indicator INPUT_METHOD_TEXT_CHANGED Reveal DetailHide Detail
      static int INPUT_METHOD_TEXT_CHANGED
      The event type indicating changed input method text.
      public static final int INPUT_METHOD_TEXT_CHANGED
      The event type indicating changed input method text. This event is generated by input methods while processing input.
      See Also:
      Constant Field Values
      Inherited member indicator INVOCATION_EVENT_MASK Reveal DetailHide Detail
      static long INVOCATION_EVENT_MASK
      The event mask for selecting invocation events.
      public static final long INVOCATION_EVENT_MASK
      The event mask for selecting invocation events.
      See Also:
      Constant Field Values
      Inherited member indicator ITEM_EVENT_MASK Reveal DetailHide Detail
      static long ITEM_EVENT_MASK
      The event mask for selecting item events.
      public static final long ITEM_EVENT_MASK
      The event mask for selecting item events.
      See Also:
      Constant Field Values
      Inherited member indicator KEY_EVENT_MASK Reveal DetailHide Detail
      static long KEY_EVENT_MASK
      The event mask for selecting key events.
      public static final long KEY_EVENT_MASK
      The event mask for selecting key events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_EVENT_MASK
      The event mask for selecting mouse events.
      public static final long MOUSE_EVENT_MASK
      The event mask for selecting mouse events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_MOTION_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_MOTION_EVENT_MASK
      The event mask for selecting mouse motion events.
      public static final long MOUSE_MOTION_EVENT_MASK
      The event mask for selecting mouse motion events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_WHEEL_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_WHEEL_EVENT_MASK
      The event mask for selecting mouse wheel events.
      public static final long MOUSE_WHEEL_EVENT_MASK
      The event mask for selecting mouse wheel events.
      Since:
      1.4
      See Also:
      Constant Field Values
      Inherited member indicator PAINT_EVENT_MASK Reveal DetailHide Detail
      static long PAINT_EVENT_MASK
      The event mask for selecting paint events.
      public static final long PAINT_EVENT_MASK
      The event mask for selecting paint events.
      See Also:
      Constant Field Values
      Inherited member indicator RESERVED_ID_MAX Reveal DetailHide Detail
      static int RESERVED_ID_MAX
      The maximum value for reserved AWT event IDs.
      public static final int RESERVED_ID_MAX
      The maximum value for reserved AWT event IDs. Programs defining their own event IDs should use IDs greater than this value.
      See Also:
      Constant Field Values
      Inherited member indicator source Reveal DetailHide Detail
      protected java.lang.Object source
      The object on which the Event initially occurred.
      protected transient java.lang.Object source
      The object on which the Event initially occurred.
      Inherited member indicator TEXT_EVENT_MASK Reveal DetailHide Detail
      static long TEXT_EVENT_MASK
      The event mask for selecting text events.
      public static final long TEXT_EVENT_MASK
      The event mask for selecting text events.
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_EVENT_MASK
      The event mask for selecting window events.
      public static final long WINDOW_EVENT_MASK
      The event mask for selecting window events.
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_FOCUS_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_FOCUS_EVENT_MASK
      The event mask for selecting window focus events.
      public static final long WINDOW_FOCUS_EVENT_MASK
      The event mask for selecting window focus events.
      Since:
      1.4
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_STATE_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_STATE_EVENT_MASK
      The event mask for selecting window state events.
      public static final long WINDOW_STATE_EVENT_MASK
      The event mask for selecting window state events.
      Since:
      1.4
      See Also:
      Constant Field Values
    • Constructors 
      Constructor and Description
      Ordinary member indicator InputMethodEvent Reveal DetailHide Detail
      InputMethodEvent(Component source, int id, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
      Constructs an InputMethodEvent with the specified source component, type, text, caret, and visiblePosition.
      public InputMethodEvent(Component source, int id, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
      Constructs an InputMethodEvent with the specified source component, type, text, caret, and visiblePosition.

      The offsets of caret and visiblePosition are relative to the current composed text; that is, the composed text within text if this is an INPUT_METHOD_TEXT_CHANGED event, the composed text within the text of the preceding INPUT_METHOD_TEXT_CHANGED event otherwise. The time stamp for this event is initialized by invoking EventQueue.getMostRecentEventTime().

      Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - the object where the event originated
      id - the event type
      text - the combined committed and composed text, committed text first; must be null when the event type is CARET_POSITION_CHANGED; may be null for INPUT_METHOD_TEXT_CHANGED if there's no committed or composed text
      committedCharacterCount - the number of committed characters in the text
      caret - the caret (a.k.a. insertion point); null if there's no caret within current composed text
      visiblePosition - the position that's most important to be visible; null if there's no recommendation for a visible position within current composed text
      Throws:
      java.lang.IllegalArgumentException - if id is not in the range INPUT_METHOD_FIRST..INPUT_METHOD_LAST; or if id is CARET_POSITION_CHANGED and text is not null; or if committedCharacterCount is not in the range 0..(text.getEndIndex() - text.getBeginIndex())
      java.lang.IllegalArgumentException - if source is null
      Ordinary member indicator InputMethodEvent Reveal DetailHide Detail
      InputMethodEvent(Component source, int id, long when, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
      Constructs an InputMethodEvent with the specified source component, type, time, text, caret, and visiblePosition.
      public InputMethodEvent(Component source, int id, long when, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
      Constructs an InputMethodEvent with the specified source component, type, time, text, caret, and visiblePosition.

      The offsets of caret and visiblePosition are relative to the current composed text; that is, the composed text within text if this is an INPUT_METHOD_TEXT_CHANGED event, the composed text within the text of the preceding INPUT_METHOD_TEXT_CHANGED event otherwise.

      Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - the object where the event originated
      id - the event type
      when - a long integer that specifies the time the event occurred
      text - the combined committed and composed text, committed text first; must be null when the event type is CARET_POSITION_CHANGED; may be null for INPUT_METHOD_TEXT_CHANGED if there's no committed or composed text
      committedCharacterCount - the number of committed characters in the text
      caret - the caret (a.k.a. insertion point); null if there's no caret within current composed text
      visiblePosition - the position that's most important to be visible; null if there's no recommendation for a visible position within current composed text
      Throws:
      java.lang.IllegalArgumentException - if id is not in the range INPUT_METHOD_FIRST..INPUT_METHOD_LAST; or if id is CARET_POSITION_CHANGED and text is not null; or if committedCharacterCount is not in the range 0..(text.getEndIndex() - text.getBeginIndex())
      java.lang.IllegalArgumentException - if source is null
      Since:
      1.4
      Ordinary member indicator InputMethodEvent Reveal DetailHide Detail
      InputMethodEvent(Component source, int id, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
      Constructs an InputMethodEvent with the specified source component, type, caret, and visiblePosition.
      public InputMethodEvent(Component source, int id, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
      Constructs an InputMethodEvent with the specified source component, type, caret, and visiblePosition. The text is set to null, committedCharacterCount to 0.

      The offsets of caret and visiblePosition are relative to the current composed text; that is, the composed text within the text of the preceding INPUT_METHOD_TEXT_CHANGED event if the event being constructed as a CARET_POSITION_CHANGED event. For an INPUT_METHOD_TEXT_CHANGED event without text, caret and visiblePosition must be null. The time stamp for this event is initialized by invoking EventQueue.getMostRecentEventTime().

      Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - the object where the event originated
      id - the event type
      caret - the caret (a.k.a. insertion point); null if there's no caret within current composed text
      visiblePosition - the position that's most important to be visible; null if there's no recommendation for a visible position within current composed text
      Throws:
      java.lang.IllegalArgumentException - if id is not in the range INPUT_METHOD_FIRST..INPUT_METHOD_LAST
      java.lang.IllegalArgumentException - if source is null
    • Methods 
      Modifier and Type Method and Description
      Overridden member indicator consume Reveal DetailHide Detail
      void consume()
      Consumes this event so that it will not be processed in the default manner by the source which originated it.
      public void consume()
      Consumes this event so that it will not be processed in the default manner by the source which originated it.
      Overrides:
      consume in class AWTEvent
      Ordinary member indicator getCaret Reveal DetailHide Detail
      java.awt.font.TextHitInfo getCaret()
      Gets the caret.
      public java.awt.font.TextHitInfo getCaret()
      Gets the caret.

      The offset of the caret is relative to the current composed text; that is, the composed text within getText() if this is an INPUT_METHOD_TEXT_CHANGED event, the composed text within getText() of the preceding INPUT_METHOD_TEXT_CHANGED event otherwise.

      Returns:
      the caret (a.k.a. insertion point). Null if there's no caret within current composed text.
      Ordinary member indicator getCommittedCharacterCount Reveal DetailHide Detail
      int getCommittedCharacterCount()
      Gets the number of committed characters in the text.
      public int getCommittedCharacterCount()
      Gets the number of committed characters in the text.
      Inherited member indicator getID Reveal DetailHide Detail
      int getID()
      Returns the event type.
      public int getID()
      Description copied from class: AWTEvent
      Returns the event type.
      Inherited member indicator getSource Reveal DetailHide Detail
      java.lang.Object getSource()
      The object on which the Event initially occurred.
      public java.lang.Object getSource()
      Description copied from class: java.util.EventObject
      The object on which the Event initially occurred.
      Returns:
      The object on which the Event initially occurred.
      Ordinary member indicator getText Reveal DetailHide Detail
      java.text.AttributedCharacterIterator getText()
      Gets the combined committed and composed text.
      public java.text.AttributedCharacterIterator getText()
      Gets the combined committed and composed text. Characters from index 0 to index getCommittedCharacterCount() - 1 are committed text, the remaining characters are composed text.
      Returns:
      the text. Always null for CARET_POSITION_CHANGED; may be null for INPUT_METHOD_TEXT_CHANGED if there's no composed or committed text.
      Ordinary member indicator getVisiblePosition Reveal DetailHide Detail
      java.awt.font.TextHitInfo getVisiblePosition()
      Gets the position that's most important to be visible.
      public java.awt.font.TextHitInfo getVisiblePosition()
      Gets the position that's most important to be visible.

      The offset of the visible position is relative to the current composed text; that is, the composed text within getText() if this is an INPUT_METHOD_TEXT_CHANGED event, the composed text within getText() of the preceding INPUT_METHOD_TEXT_CHANGED event otherwise.

      Returns:
      the position that's most important to be visible. Null if there's no recommendation for a visible position within current composed text.
      Ordinary member indicator getWhen Reveal DetailHide Detail
      long getWhen()
      Returns the time stamp of when this event occurred.
      public long getWhen()
      Returns the time stamp of when this event occurred.
      Returns:
      this event's timestamp
      Since:
      1.4
      Overridden member indicator isConsumed Reveal DetailHide Detail
      boolean isConsumed()
      Returns whether or not this event has been consumed.
      public boolean isConsumed()
      Returns whether or not this event has been consumed.
      Overrides:
      isConsumed in class AWTEvent
      See Also:
      consume()
      Overridden member indicator paramString Reveal DetailHide Detail
      java.lang.String paramString()
      Returns a parameter string identifying this event.
      public java.lang.String paramString()
      Returns a parameter string identifying this event. This method is useful for event-logging and for debugging. It contains the event ID in text form, the characters of the committed and composed text separated by "+", the number of committed characters, the caret, and the visible position.
      Overrides:
      paramString in class AWTEvent
      Returns:
      a string identifying the event and its attributes
      Inherited member indicator setSource Reveal DetailHide Detail
      void setSource(java.lang.Object newSource)
      Retargets an event to a new source.
      public void setSource(java.lang.Object newSource)
      Description copied from class: AWTEvent
      Retargets an event to a new source. This method is typically used to retarget an event to a lightweight child Component of the original heavyweight source.

      This method is intended to be used only by event targeting subsystems, such as client-defined KeyboardFocusManagers. It is not for general client use.

      Parameters:
      newSource - the new Object to which the event should be dispatched
      Since:
      1.4
      Inherited member indicator toString Reveal DetailHide Detail
      java.lang.String toString()
      Returns a String representation of this object.
      public java.lang.String toString()
      Description copied from class: AWTEvent
      Returns a String representation of this object.
      Overrides:
      toString in class java.util.EventObject
      Returns:
      A a String representation of this EventObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge