- java.lang.Object
-
- java.awt.ComponentOrientation
-
- All Implemented Interfaces:
- Serializable
public final class ComponentOrientation extends Object implements Serializable
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
(In the header, the two-letter abbreviation represents the item direction in the first letter, and the line direction in the second. For example, LT means "items left-to-right, lines top-to-bottom", TL means "items top-to-bottom, lines left-to-right", and so on.)The orientations are:
- LT - Western Europe (optional for Japanese, Chinese, Korean)
- RT - Middle East (Arabic, Hebrew)
- TR - Japanese, Chinese, Korean
- TL - Mongolian
isLeftToRight()
andisHorizontal()
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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static ComponentOrientation
LEFT_TO_RIGHT
Items run left to right and lines flow top to bottom Examples: English, French.static ComponentOrientation
RIGHT_TO_LEFT
Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew.static ComponentOrientation
UNKNOWN
Indicates that a component's orientation has not been set.
-
Method Summary
Methods Modifier and Type Method and Description static ComponentOrientation
getOrientation(Locale locale)
Returns the orientation that is appropriate for the given locale.static ComponentOrientation
getOrientation(ResourceBundle bdl)
Deprecated.As of J2SE 1.4, usegetOrientation(java.util.Locale)
.boolean
isHorizontal()
Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman.boolean
isLeftToRight()
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.
-
-
-
Field Detail
-
LEFT_TO_RIGHT
public static final ComponentOrientation LEFT_TO_RIGHT
Items run left to right and lines flow top to bottom Examples: English, French.
-
RIGHT_TO_LEFT
public static final ComponentOrientation RIGHT_TO_LEFT
Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew.
-
UNKNOWN
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.
-
-
Method Detail
-
isHorizontal
public boolean isHorizontal()
Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman.
-
isLeftToRight
public boolean isLeftToRight()
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.
-
getOrientation
public static ComponentOrientation getOrientation(Locale locale)
Returns the orientation that is appropriate for the given locale.- Parameters:
locale
- the specified locale
-
getOrientation
@Deprecated public static ComponentOrientation getOrientation(ResourceBundle bdl)
Deprecated. As of J2SE 1.4, usegetOrientation(java.util.Locale)
.Returns the orientation appropriate for the given ResourceBundle's localization. Three approaches are tried, in the following order:- Retrieve a ComponentOrientation object from the ResourceBundle using the string "Orientation" as the key.
- Use the ResourceBundle.getLocale to determine the bundle's locale, then return the orientation for that locale.
- Return the default locale's orientation.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/awt/ComponentOrientation.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.