src/share/classes/sun/awt/SunToolkit.java

Print this page




1104     /**
1105      * Gives native peers the ability to query the closest HW component.
1106      * If the given component is heavyweight, then it returns this. Otherwise,
1107      * it goes one level up in the hierarchy and tests next component.
1108      */
1109     public static Component getHeavyweightComponent(Component c) {
1110         while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) {
1111             c = AWTAccessor.getComponentAccessor().getParent(c);
1112         }
1113         return c;
1114     }
1115 
1116     /**
1117      * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
1118      */
1119     public int getFocusAcceleratorKeyMask() {
1120         return InputEvent.ALT_MASK;
1121     }
1122 
1123     /**










1124      * Returns a new input method window, with behavior as specified in
1125      * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
1126      * If the inputContext is not null, the window should return it from its
1127      * getInputContext() method. The window needs to implement
1128      * sun.awt.im.InputMethodWindow.
1129      * <p>
1130      * SunToolkit subclasses can override this method to return better input
1131      * method windows.
1132      */
1133     public Window createInputMethodWindow(String title, InputContext context) {
1134         return new sun.awt.im.SimpleInputMethodWindow(title, context);
1135     }
1136 
1137     /**
1138      * Returns whether enableInputMethods should be set to true for peered
1139      * TextComponent instances on this platform. False by default.
1140      */
1141     public boolean enableInputMethodsForTextComponent() {
1142         return false;
1143     }




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