1109 /** 1110 * Gives native peers the ability to query the closest HW component. 1111 * If the given component is heavyweight, then it returns this. Otherwise, 1112 * it goes one level up in the hierarchy and tests next component. 1113 */ 1114 public static Component getHeavyweightComponent(Component c) { 1115 while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) { 1116 c = AWTAccessor.getComponentAccessor().getParent(c); 1117 } 1118 return c; 1119 } 1120 1121 /** 1122 * Returns key modifiers used by Swing to set up a focus accelerator key stroke. 1123 */ 1124 public int getFocusAcceleratorKeyMask() { 1125 return InputEvent.ALT_MASK; 1126 } 1127 1128 /** 1129 * Returns a new input method window, with behavior as specified in 1130 * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}. 1131 * If the inputContext is not null, the window should return it from its 1132 * getInputContext() method. The window needs to implement 1133 * sun.awt.im.InputMethodWindow. 1134 * <p> 1135 * SunToolkit subclasses can override this method to return better input 1136 * method windows. 1137 */ 1138 public Window createInputMethodWindow(String title, InputContext context) { 1139 return new sun.awt.im.SimpleInputMethodWindow(title, context); 1140 } 1141 1142 /** 1143 * Returns whether enableInputMethods should be set to true for peered 1144 * TextComponent instances on this platform. False by default. 1145 */ 1146 public boolean enableInputMethodsForTextComponent() { 1147 return false; 1148 } | 1109 /** 1110 * Gives native peers the ability to query the closest HW component. 1111 * If the given component is heavyweight, then it returns this. Otherwise, 1112 * it goes one level up in the hierarchy and tests next component. 1113 */ 1114 public static Component getHeavyweightComponent(Component c) { 1115 while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) { 1116 c = AWTAccessor.getComponentAccessor().getParent(c); 1117 } 1118 return c; 1119 } 1120 1121 /** 1122 * Returns key modifiers used by Swing to set up a focus accelerator key stroke. 1123 */ 1124 public int getFocusAcceleratorKeyMask() { 1125 return InputEvent.ALT_MASK; 1126 } 1127 1128 /** 1129 * Tests whether specified key modifiers mask can be used to enter a printable 1130 * character. This is a default implementation of this method, which reflects 1131 * the way things work on Windows: here, pressing ctrl + alt allows user to enter 1132 * characters from the extended character set (like euro sign or math symbols) 1133 */ 1134 public boolean isPrintableCharacterModifiersMask(int mods) { 1135 return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK)); 1136 } 1137 1138 /** 1139 * Returns a new input method window, with behavior as specified in 1140 * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}. 1141 * If the inputContext is not null, the window should return it from its 1142 * getInputContext() method. The window needs to implement 1143 * sun.awt.im.InputMethodWindow. 1144 * <p> 1145 * SunToolkit subclasses can override this method to return better input 1146 * method windows. 1147 */ 1148 public Window createInputMethodWindow(String title, InputContext context) { 1149 return new sun.awt.im.SimpleInputMethodWindow(title, context); 1150 } 1151 1152 /** 1153 * Returns whether enableInputMethods should be set to true for peered 1154 * TextComponent instances on this platform. False by default. 1155 */ 1156 public boolean enableInputMethodsForTextComponent() { 1157 return false; 1158 } |