|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.ComponentOrientation
Safe: The ComponentOrientation class encapsulates the language-sensitive orientation that is to be used to order the elements of a component or of text. It is used to reflect the differences in this ordering between Western alphabets, Middle Eastern (such as Hebrew), and Far Eastern (such as Japanese).
Fundamentally, this governs items (such as characters) which are laid out in lines, with the lines then laid out in a block. This also applies to items in a widget: for example, in a check box where the box is positioned relative to the text.
There are four different orientations used in modern languages
as in the following table.
LT RT TL TR A B C C B A A D G G D A D E F F E D B E H H E B G H I I H G C F I I F C
The orientations are:
isLeftToRight()
and
isHorizontal()
methods to
determine their behavior. They should not include switch-like
code that keys off of the constants, such as:
if (orientation == LEFT_TO_RIGHT) { ... } else if (orientation == RIGHT_TO_LEFT) { ... } else { // Oops }This is unsafe, since more constants may be added in the future and since it is not guaranteed that orientation objects will be unique.
Field Summary | |
private static int |
HORIZ_BIT
|
static ComponentOrientation |
LEFT_TO_RIGHT
Suppressed: Items run left to right and lines flow top to bottom Examples: English, French. |
private static int |
LTR_BIT
|
private int |
orientation
|
static ComponentOrientation |
RIGHT_TO_LEFT
Suppressed: Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew. |
private static int |
UNK_BIT
|
static ComponentOrientation |
UNKNOWN
Suppressed: Indicates that a component's orientation has not been set. |
Constructor Summary | |
private |
ComponentOrientation(int value)
|
Method Summary | |
static ComponentOrientation |
getOrientation(Locale locale)
Enabled: Returns the orientation that is appropriate for the given locale. |
static ComponentOrientation |
getOrientation(ResourceBundle bdl)
Deprecated. As of J2SE 1.4, use getOrientation(java.util.Locale) . |
boolean |
isHorizontal()
Enabled: Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman. |
boolean |
isLeftToRight()
Enabled: HorizontalLines: Do items run left-to-right? Vertical Lines: Do lines run left-to-right? This will return true for horizontal, left-to-right writing systems such as Roman. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int UNK_BIT
private static final int HORIZ_BIT
private static final int LTR_BIT
public static final ComponentOrientation LEFT_TO_RIGHT
public static final ComponentOrientation RIGHT_TO_LEFT
public static final ComponentOrientation UNKNOWN
private int orientation
Constructor Detail |
private ComponentOrientation(int value)
Method Detail |
public boolean isHorizontal()
public boolean isLeftToRight()
public static ComponentOrientation getOrientation(Locale locale)
locale
- the specified localepublic static ComponentOrientation getOrientation(ResourceBundle bdl)
getOrientation(java.util.Locale)
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |