java.lang.Objectjava.util.EventObject
java.awt.AWTEvent
java.awt.event.InputMethodEvent
public class InputMethodEvent
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.
| Field Summary | |
|---|---|
static int |
CARET_POSITION_CHANGED
The event type indicating a changed insertion point in input method text. |
static int |
INPUT_METHOD_FIRST
Marks the first integer id for the range of input method event ids. |
static int |
INPUT_METHOD_LAST
Marks the last integer id for the range of input method event ids. |
static int |
INPUT_METHOD_TEXT_CHANGED
The event type indicating changed input method text. |
| Fields inherited from class java.util.EventObject |
|---|
source |
| Constructor Summary | |
|---|---|
InputMethodEvent(Component source,
int id,
AttributedCharacterIterator text,
int committedCharacterCount,
TextHitInfo caret,
TextHitInfo visiblePosition)
Constructs an InputMethodEvent with the specified
source component, type, text, caret, and visiblePosition. |
|
InputMethodEvent(Component source,
int id,
long when,
AttributedCharacterIterator text,
int committedCharacterCount,
TextHitInfo caret,
TextHitInfo visiblePosition)
Constructs an InputMethodEvent with the specified
source component, type, time, text, caret, and visiblePosition. |
|
InputMethodEvent(Component source,
int id,
TextHitInfo caret,
TextHitInfo visiblePosition)
Constructs an InputMethodEvent with the
specified source component, type, caret, and visiblePosition. |
|
| Method Summary | |
|---|---|
void |
consume()
Consumes this event so that it will not be processed in the default manner by the source which originated it. |
TextHitInfo |
getCaret()
Gets the caret. |
int |
getCommittedCharacterCount()
Gets the number of committed characters in the text. |
AttributedCharacterIterator |
getText()
Gets the combined committed and composed text. |
TextHitInfo |
getVisiblePosition()
Gets the position that's most important to be visible. |
long |
getWhen()
Returns the time stamp of when this event occurred. |
boolean |
isConsumed()
Returns whether or not this event has been consumed. |
String |
paramString()
Returns a parameter string identifying this event. |
| Methods inherited from class java.awt.AWTEvent |
|---|
getID, setSource, toString |
| Methods inherited from class java.util.EventObject |
|---|
getSource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int INPUT_METHOD_FIRST
public static final int INPUT_METHOD_TEXT_CHANGED
public static final int CARET_POSITION_CHANGED
public static final int INPUT_METHOD_LAST
| Constructor Detail |
|---|
public InputMethodEvent(Component source, int id, long when, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)
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.
source - the object where the event originatedid - the event typewhen - a long integer that specifies the time the event occurredtext - 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 textcommittedCharacterCount - the number of committed
characters in the textcaret - the caret (a.k.a. insertion point);
null if there's no caret within current
composed textvisiblePosition - the position that's most important
to be visible; null if there's no
recommendation for a visible position within current
composed text
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())
IllegalArgumentException - if source is nullpublic InputMethodEvent(Component source, int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)
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.
source - the object where the event originatedid - the event typetext - 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 textcommittedCharacterCount - the number of committed
characters in the textcaret - the caret (a.k.a. insertion point);
null if there's no caret within current
composed textvisiblePosition - the position that's most important
to be visible; null if there's no
recommendation for a visible position within current
composed text
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())
IllegalArgumentException - if source is nullpublic InputMethodEvent(Component source, int id, TextHitInfo caret, TextHitInfo visiblePosition)
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.
source - the object where the event originatedid - the event typecaret - the caret (a.k.a. insertion point);
null if there's no caret within current
composed textvisiblePosition - the position that's most important
to be visible; null if there's no
recommendation for a visible position within current
composed text
IllegalArgumentException - if id is not
in the range
INPUT_METHOD_FIRST..INPUT_METHOD_LAST
IllegalArgumentException - if source is null| Method Detail |
|---|
public AttributedCharacterIterator getText()
getCommittedCharacterCount() - 1 are committed
text, the remaining characters are composed text.
public int getCommittedCharacterCount()
public TextHitInfo getCaret()
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.
public TextHitInfo getVisiblePosition()
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.
public void consume()
public boolean isConsumed()
isConsumed in class AWTEventconsume()public long getWhen()
public String paramString()
paramString in class AWTEventCes informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
8 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)