1 7 8 package java.awt.im; 9 10 import java.awt.font.TextAttribute ; 11 import java.util.Map ; 12 13 51 52 public class InputMethodHighlight { 53 54 57 public final static int RAW_TEXT = 0; 58 59 62 public final static int CONVERTED_TEXT = 1; 63 64 65 68 public final static InputMethodHighlight UNSELECTED_RAW_TEXT_HIGHLIGHT = 69 new InputMethodHighlight (false, RAW_TEXT); 70 71 74 public final static InputMethodHighlight SELECTED_RAW_TEXT_HIGHLIGHT = 75 new InputMethodHighlight (true, RAW_TEXT); 76 77 80 public final static InputMethodHighlight UNSELECTED_CONVERTED_TEXT_HIGHLIGHT = 81 new InputMethodHighlight (false, CONVERTED_TEXT); 82 83 86 public final static InputMethodHighlight SELECTED_CONVERTED_TEXT_HIGHLIGHT = 87 new InputMethodHighlight (true, CONVERTED_TEXT); 88 89 90 99 public InputMethodHighlight(boolean selected, int state) { 100 this(selected, state, 0, null); 101 } 102 103 113 public InputMethodHighlight(boolean selected, int state, int variation) { 114 this(selected, state, variation, null); 115 } 116 117 129 public InputMethodHighlight(boolean selected, int state, int variation, 130 Map <TextAttribute ,?> style) 131 { 132 this.selected = selected; 133 if (!(state == RAW_TEXT || state == CONVERTED_TEXT)) { 134 throw new IllegalArgumentException ("unknown input method highlight state"); 135 } 136 this.state = state; 137 this.variation = variation; 138 this.style = style; 139 } 140 141 144 public boolean isSelected() { 145 return selected; 146 } 147 148 154 public int getState() { 155 return state; 156 } 157 158 161 public int getVariation() { 162 return variation; 163 } 164 165 169 public Map <TextAttribute ,?> getStyle() { 170 return style; 171 } 172 173 private boolean selected; 174 private int state; 175 private int variation; 176 private Map style; 177 178 }; 179 | Popular Tags |