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.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| public static final ComponentOrientation | LEFT_TO_RIGHT
Items run left to right and lines flow top to bottom Examples: English, French. |
| private static final int | |
| private int | |
| public static final ComponentOrientation | RIGHT_TO_LEFT
Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew. |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.6 for interoperability. |
| private static final int | |
| public static final ComponentOrientation | UNKNOWN
Indicates that a component's orientation has not been set. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ComponentOrientation | Returns: the orientation for the localethe specified locale locale)Returns the orientation that is appropriate for the given locale. |
| public static ComponentOrientation | Returns: the orientationthe bundle to use bdl)
Deprecated
As of J2SE 1.4, use
getOrientation(java..
Returns the orientation appropriate for the given ResourceBundle's localization. |
| public boolean | |
| public boolean | Returns: true if this orientation is left-to-rightHorizontalLines: Do items run left-to-right? |
| HORIZ_BIT | back to summary |
|---|---|
| private static final int HORIZ_BIT | |
| LEFT_TO_RIGHT | back to summary |
|---|---|
| public static final ComponentOrientation LEFT_TO_RIGHT Items run left to right and lines flow top to bottom Examples: English, French. | |
| LTR_BIT | back to summary |
|---|---|
| private static final int LTR_BIT | |
| orientation | back to summary |
|---|---|
| private int orientation | |
| RIGHT_TO_LEFT | back to summary |
|---|---|
| public static final ComponentOrientation RIGHT_TO_LEFT Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.6 for interoperability. | |
| UNK_BIT | back to summary |
|---|---|
| private static final int UNK_BIT | |
| UNKNOWN | back to summary |
|---|---|
| public static final ComponentOrientation UNKNOWN Indicates that a component's orientation has not been set. To preserve the behavior of existing applications, isLeftToRight will return true for this value. | |
| ComponentOrientation | back to summary |
|---|---|
| private ComponentOrientation(int value) | |
| getOrientation | back to summary |
|---|---|
| public static ComponentOrientation getOrientation(Locale locale) Returns the orientation that is appropriate for the given locale.
| |
| getOrientation | back to summary |
|---|---|
| public static ComponentOrientation getOrientation(ResourceBundle bdl)
Deprecated As of J2SE 1.4, use Returns the orientation appropriate for the given ResourceBundle's localization. Three approaches are tried, in the following order:
| |
| isHorizontal | back to summary |
|---|---|
| public boolean isHorizontal() Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman.
| |
| isLeftToRight | back to summary |
|---|---|
| public boolean isLeftToRight() HorizontalLines: Do items run left-to-right?
| |