Class VTextIcon
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Icon
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)
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the icon's height.int
Returns the icon's width.getLabel()
void
Draw the icon at the specified location.void
Checks for changes to the font on the fComponent so that it can invalidate the layout if the size changesvoid
setDisabledForeground
(Color disabledForeground) void
sets the label to the given string, updating the orientation as needed and invalidating the layout if the size changesstatic int
verifyRotation
(String label, int rotateHint) verifyRotation
-
Field Details
-
ROTATE_DEFAULT
public static final int ROTATE_DEFAULT- See Also:
-
ROTATE_NONE
public static final int ROTATE_NONE- See Also:
-
ROTATE_LEFT
public static final int ROTATE_LEFT- See Also:
-
ROTATE_RIGHT
public static final int ROTATE_RIGHT- See Also:
-
-
Constructor Details
-
VTextIcon
Creates aVTextIcon
for the specifiedcomponent
with the specifiedlabel
.It sets the orientation to the default for the string
- Parameters:
component
-label
-- See Also:
-
VTextIcon
Creates aVTextIcon
for the specifiedcomponent
with the specifiedlabel
.It sets the orientation to the provided value if it's legal for the string
- Parameters:
component
-label
-rotateHint
-- See Also:
-
-
Method Details
-
setLabel
sets the label to the given string, updating the orientation as needed and invalidating the layout if the size changes- Parameters:
label
-- See Also:
-
getLabel
-
propertyChange
Checks for changes to the font on the fComponent so that it can invalidate the layout if the size changes- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
e
-
-
paintIcon
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.
-
getIconWidth
public int getIconWidth()Returns the icon's width.- Specified by:
getIconWidth
in interfaceIcon
- Returns:
- an int specifying the fixed width of the icon.
-
getIconHeight
public int getIconHeight()Returns the icon's height.- Specified by:
getIconHeight
in interfaceIcon
- Returns:
- an int specifying the fixed height of the icon.
-
getDisabledForeground
- Returns:
- the disabledForeground
-
setDisabledForeground
- Parameters:
disabledForeground
- the disabledForeground to set
-
verifyRotation
verifyRotationreturns 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� counterclockwise so that the characters are ordered from top to bottom. Latin text and numbers may be rotated 90� 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 sections 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
-