1 19 20 package swingwt.awt.event; 21 22 import java.text.AttributedCharacterIterator ; 23 24 import swingwt.awt.AWTEvent; 25 import swingwt.awt.Component; 26 import swingwt.awt.font.TextHitInfo; 27 28 31 public class InputMethodEvent extends AWTEvent 32 { 33 public static final int INPUT_METHOD_FIRST = 1100; 34 public static final int INPUT_METHOD_TEXT_CHANGED = INPUT_METHOD_FIRST; 35 public static final int CARET_POSITION_CHANGED = INPUT_METHOD_FIRST + 1; 36 public static final int INPUT_METHOD_LAST = INPUT_METHOD_FIRST + 1; 37 38 private AttributedCharacterIterator text; 39 private int committedCharacterCount; 40 private TextHitInfo caret; 41 private TextHitInfo visiblePosition; 42 private long when; 43 44 public InputMethodEvent( Component source, int id, AttributedCharacterIterator text, int committedCharacterCount, 45 TextHitInfo caret, TextHitInfo visiblePosition ) 46 { 47 this( source, id, 0, text, committedCharacterCount, caret, visiblePosition ); 48 } 49 50 public InputMethodEvent( Component source, int id, long when, AttributedCharacterIterator text, 51 int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition ) 52 { 53 super(source, id); 54 this.text = text; 55 this.committedCharacterCount = committedCharacterCount; 56 this.caret = caret; 57 this.visiblePosition = visiblePosition; 58 this.when = when; 59 } 60 61 public InputMethodEvent( Component source, int id, TextHitInfo caret, TextHitInfo visiblePosition ) 62 { 63 this( source, id, 0, null, 0, caret, visiblePosition ); 64 } 65 66 public AttributedCharacterIterator getText() { return text; } 67 public int getCommittedCharacterCount() { return committedCharacterCount; } 68 public TextHitInfo getCaret() { return caret; } 69 public TextHitInfo getVisiblePosition() { return visiblePosition; } 70 public void consume() { consumed = true; } 71 public boolean isConsumed() { return consumed; } 72 73 public long getWhen() 74 { 75 throw new UnsupportedOperationException ("getWhen (event time) is not implemented!"); 76 } 77 78 public String paramString() 79 { 80 return toString(); 81 } 82 } 83 | Popular Tags |