1032 */ 1033 public static Container getNativeContainer(Component c) { 1034 return Toolkit.getNativeContainer(c); 1035 } 1036 1037 /** 1038 * Gives native peers the ability to query the closest HW component. 1039 * If the given component is heavyweight, then it returns this. Otherwise, 1040 * it goes one level up in the hierarchy and tests next component. 1041 */ 1042 public static Component getHeavyweightComponent(Component c) { 1043 while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) { 1044 c = AWTAccessor.getComponentAccessor().getParent(c); 1045 } 1046 return c; 1047 } 1048 1049 /** 1050 * Returns key modifiers used by Swing to set up a focus accelerator key stroke. 1051 */ 1052 public int getFocusAcceleratorKeyMask() { 1053 return InputEvent.ALT_MASK; 1054 } 1055 1056 /** 1057 * Tests whether specified key modifiers mask can be used to enter a printable 1058 * character. This is a default implementation of this method, which reflects 1059 * the way things work on Windows: here, pressing ctrl + alt allows user to enter 1060 * characters from the extended character set (like euro sign or math symbols) 1061 */ 1062 public boolean isPrintableCharacterModifiersMask(int mods) { 1063 return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK)); 1064 } 1065 1066 /** 1067 * Returns whether popup is allowed to be shown above the task bar. 1068 * This is a default implementation of this method, which checks 1069 * corresponding security permission. 1070 */ 1071 public boolean canPopupOverlapTaskBar() { 1072 boolean result = true; 1073 try { 1074 SecurityManager sm = System.getSecurityManager(); 1075 if (sm != null) { 1076 sm.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); 1077 } 1078 } catch (SecurityException se) { 1079 // There is no permission to show popups over the task bar 1080 result = false; 1081 } | 1032 */ 1033 public static Container getNativeContainer(Component c) { 1034 return Toolkit.getNativeContainer(c); 1035 } 1036 1037 /** 1038 * Gives native peers the ability to query the closest HW component. 1039 * If the given component is heavyweight, then it returns this. Otherwise, 1040 * it goes one level up in the hierarchy and tests next component. 1041 */ 1042 public static Component getHeavyweightComponent(Component c) { 1043 while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) { 1044 c = AWTAccessor.getComponentAccessor().getParent(c); 1045 } 1046 return c; 1047 } 1048 1049 /** 1050 * Returns key modifiers used by Swing to set up a focus accelerator key stroke. 1051 */ 1052 @SuppressWarnings("deprecation") 1053 public int getFocusAcceleratorKeyMask() { 1054 return InputEvent.ALT_MASK; 1055 } 1056 1057 /** 1058 * Tests whether specified key modifiers mask can be used to enter a printable 1059 * character. This is a default implementation of this method, which reflects 1060 * the way things work on Windows: here, pressing ctrl + alt allows user to enter 1061 * characters from the extended character set (like euro sign or math symbols) 1062 */ 1063 @SuppressWarnings("deprecation") 1064 public boolean isPrintableCharacterModifiersMask(int mods) { 1065 return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK)); 1066 } 1067 1068 /** 1069 * Returns whether popup is allowed to be shown above the task bar. 1070 * This is a default implementation of this method, which checks 1071 * corresponding security permission. 1072 */ 1073 public boolean canPopupOverlapTaskBar() { 1074 boolean result = true; 1075 try { 1076 SecurityManager sm = System.getSecurityManager(); 1077 if (sm != null) { 1078 sm.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); 1079 } 1080 } catch (SecurityException se) { 1081 // There is no permission to show popups over the task bar 1082 result = false; 1083 } |