java::awt::ComponentOrientation Class Reference

Inheritance diagram for java::awt::ComponentOrientation:

Inheritance graph
java::lang::Object
[legend]
Collaboration diagram for java::awt::ComponentOrientation:

Collaboration graph
java::lang::Object
[legend]

List of all members.


Detailed Description

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", BL means "items bottom-to-top, lines bottom-to-top", and so on.)

The orientations are:

Components whose view and controller code depends on orientation should use the 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.

Public Member Functions

 ComponentOrientation ()
 Default constructor.
virtual jboolean isHorizontal () const
 Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman.
virtual jboolean isLeftToRight () const
 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.

Static Public Attributes

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.

Constructor & Destructor Documentation

java::awt::ComponentOrientation::ComponentOrientation (  ) 

Default constructor.


Member Function Documentation

virtual jboolean java::awt::ComponentOrientation::isHorizontal (  )  const [virtual]

Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman.

virtual jboolean java::awt::ComponentOrientation::isLeftToRight (  )  const [virtual]

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.


Member Data Documentation

ComponentOrientation java::awt::ComponentOrientation::LEFT_TO_RIGHT [static]

Items run left to right and lines flow top to bottom Examples: English, French.

ComponentOrientation java::awt::ComponentOrientation::RIGHT_TO_LEFT [static]

Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew.

ComponentOrientation java::awt::ComponentOrientation::UNKNOWN [static]

Indicates that a component's orientation has not been set.

To preserve the behavior of existing applications, isLeftToRight will return true for this value.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:55:56 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3