Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 7 8 18 19 package java.awt; 20 21 import java.util.Locale ; 22 import java.util.ResourceBundle ; 23 24 73 public final class ComponentOrientation implements java.io.Serializable  74 { 75 private static final int UNK_BIT = 1; 77 private static final int HORIZ_BIT = 2; 78 private static final int LTR_BIT = 4; 79 80 84 public static final ComponentOrientation LEFT_TO_RIGHT = 85 new ComponentOrientation (HORIZ_BIT|LTR_BIT); 86 87 91 public static final ComponentOrientation RIGHT_TO_LEFT = 92 new ComponentOrientation (HORIZ_BIT); 93 94 99 public static final ComponentOrientation UNKNOWN = 100 new ComponentOrientation (HORIZ_BIT|LTR_BIT|UNK_BIT); 101 102 107 public boolean isHorizontal() { 108 return (orientation & HORIZ_BIT) != 0; 109 } 110 111 117 public boolean isLeftToRight() { 118 return (orientation & LTR_BIT) != 0; 119 } 120 121 125 public static ComponentOrientation getOrientation(Locale locale) { 126 String lang = locale.getLanguage(); 131 if( "iw".equals(lang) || "ar".equals(lang) 132 || "fa".equals(lang) || "ur".equals(lang) ) 133 { 134 return RIGHT_TO_LEFT; 135 } else { 136 return LEFT_TO_RIGHT; 137 } 138 } 139 140 153 @Deprecated  154 public static ComponentOrientation getOrientation(ResourceBundle bdl) 155 { 156 ComponentOrientation result = null; 157 158 try { 159 result = (ComponentOrientation )bdl.getObject("Orientation"); 160 } 161 catch (Exception e) { 162 } 163 164 if (result == null) { 165 result = getOrientation(bdl.getLocale()); 166 } 167 if (result == null) { 168 result = getOrientation(Locale.getDefault()); 169 } 170 return result; 171 } 172 173 private int orientation; 174 175 private ComponentOrientation(int value) 176 { 177 orientation = value; 178 } 179 } 180
| Popular Tags
|