VTextIcon Class Reference

VTextIcon is an Icon implementation which draws a short string vertically. More...

List of all members.

Public Member Functions

int getIconHeight ()
 Returns the icon's height.
int getIconWidth ()
 Returns the icon's width.
void paintIcon (Component c, Graphics g, int x, int y)
 Draw the icon at the specified location.
void propertyChange (PropertyChangeEvent e)
 Checks for changes to the font on the fComponent so that it can invalidate the layout if the size changes.
void setLabel (String label)
 sets the label to the given string, updating the orientation as needed and invalidating the layout if the size changes
 VTextIcon (Component component, String label, int rotateHint)
 Creates a VTextIcon for the specified component with the specified label.
 VTextIcon (Component component, String label)
 Creates a VTextIcon for the specified component with the specified label.

Static Public Member Functions

static int verifyRotation (String label, int rotateHint)
 verifyRotation

Static Public Attributes

static final int ROTATE_DEFAULT = 0x00
static final int ROTATE_LEFT = 0x02
static final int ROTATE_NONE = 0x01
static final int ROTATE_RIGHT = 0x04

Package Functions

void calcDimensions ()
void recalcDimensions ()
 Calculates the dimensions.

Package Attributes

int fCharHeight
String[] fCharStrings
int[] fCharWidths
Component fComponent
int fDescent
int fHeight
String fLabel
int[] fPosition
int fRotation
int fWidth

Static Package Attributes

static final int DEFAULT_CJK = ROTATE_NONE
static final int DEFAULT_MUST_ROTATE = ROTATE_LEFT
static final int DEFAULT_ROMAN = ROTATE_RIGHT
static final int kBufferSpace = 5
static final int LEGAL_MUST_ROTATE = ROTATE_LEFT | ROTATE_RIGHT
static final int LEGAL_ROMAN = ROTATE_NONE | ROTATE_LEFT | ROTATE_RIGHT
static final double NINETY_DEGREES = Math.toRadians(90.0)
static final int POSITION_FAR_TOP_RIGHT = 2
static final int POSITION_NORMAL = 0
static final int POSITION_TOP_RIGHT = 1
static final String sDrawsInFarTopRight = "\u3001\u3002"
static final String sDrawsInTopRight


Detailed Description

VTextIcon is an Icon implementation which draws a short string vertically.

It's useful for JTabbedPanes with LEFT or RIGHT tabs but can be used in any component which supports Icons, such as JLabel or JButton

You can provide a hint to indicate whether to rotate the string to the left or right, or not at all, and it checks to make sure that the rotation is legal for the given string (for example, Chinese/Japanese/Korean scripts have special rules when drawn vertically and should never be rotated)


Constructor & Destructor Documentation

VTextIcon ( Component  component,
String  label 
)

Creates a VTextIcon for the specified component with the specified label.

It sets the orientation to the default for the string

See also:
verifyRotation

VTextIcon ( Component  component,
String  label,
int  rotateHint 
)

Creates a VTextIcon for the specified component with the specified label.

It sets the orientation to the provided value if it's legal for the string

See also:
verifyRotation


Member Function Documentation

int getIconHeight (  ) 

Returns the icon's height.

Returns:
an int specifying the fixed height of the icon.

int getIconWidth (  ) 

Returns the icon's width.

Returns:
an int specifying the fixed width of the icon.

void paintIcon ( Component  c,
Graphics  g,
int  x,
int  y 
)

Draw the icon at the specified location.

Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.

void recalcDimensions (  )  [package]

Calculates the dimensions.

If they've changed, invalidates the component

void setLabel ( String  label  ) 

sets the label to the given string, updating the orientation as needed and invalidating the layout if the size changes

See also:
verifyRotation

static int verifyRotation ( String  label,
int  rotateHint 
) [static]

verifyRotation

returns the best rotation for the string (ROTATE_NONE, ROTATE_LEFT, ROTATE_RIGHT)

This is public static so you can use it to test a string without creating a VTextIcon

from http://www.unicode.org/unicode/reports/tr9/tr9-3.html When setting text using the Arabic script in vertical lines, it is more common to employ a horizontal baseline that is rotated by 90 deg counterclockwise so that the characters are ordered from top to bottom. Latin text and numbers may be rotated 90 deg clockwise so that the characters are also ordered from top to bottom.

Rotation rules

  • Roman can rotate left, right, or none - default right (counterclockwise)
  • CJK can't rotate
  • Arabic must rotate - default left (clockwise)

from the online edition of _The Unicode Standard, Version 3.0_, file ch10.pdf page 4 Ideographs are found in three blocks of the Unicode Standard... U+4E00-U+9FFF, U+3400-U+4DFF, U+F900-U+FAFF

Hiragana is U+3040-U+309F, katakana is U+30A0-U+30FF

from http://www.unicode.org/unicode/faq/writingdirections.html East Asian scripts are frequently written in vertical lines which run from top-to-bottom and are arrange columns either from left-to-right (Mongolian) or right-to-left (other scripts). Most characters use the same shape and orientation when displayed horizontally or vertically, but many punctuation characters will change their shape when displayed vertically.

Letters and words from other scripts are generally rotated through ninety degree angles so that they, too, will read from top to bottom. That is, letters from left-to-right scripts will be rotated clockwise and letters from right-to-left scripts counterclockwise, both through ninety degree angles.

Unlike the bidirectional case, the choice of vertical layout is usually treated as a formatting style; therefore, the Unicode Standard does not define default rendering behavior for vertical text nor provide directionality controls designed to override such behavior


Member Data Documentation

final String sDrawsInTopRight [static, package]

Initial value:

 
                "\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E" + 
                "\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6"


The documentation for this class was generated from the following file:

Reference Manual, 2006 developed in ParaDiSe laboratory, Faculty of Informatics, Masaryk University