public class IlvVerticalTextIcon extends Object implements Icon, PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
static int |
ROTATE_DEFAULT
Default rotation hint.
|
static int |
ROTATE_LEFT
Left rotation hint.
|
static int |
ROTATE_NONE
No rotation hint.
|
static int |
ROTATE_RIGHT
Right rotation hint.
|
Constructor and Description |
---|
IlvVerticalTextIcon(Component component,
String label)
Creates a
IlvVerticalTextIcon for the specified component
with the specified label . |
IlvVerticalTextIcon(Component component,
String label,
int rotateHint)
Creates a
IlvVerticalTextIcon for the specified component
with the specified label . |
Modifier and Type | Method and Description |
---|---|
int |
getIconHeight()
Returns the icon's height.
|
int |
getIconWidth()
Returns the icon's width.
|
void |
paintIcon(Component c,
Graphics g,
int x,
int y)
Draws 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.
|
static int |
verifyRotation(String label,
int rotateHint)
Returns the best rotation for the string
(ROTATE_NONE, ROTATE_LEFT, ROTATE_RIGHT)
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 degrees counterclockwise so that the characters
are ordered from top to bottom.
|
public static final int ROTATE_DEFAULT
public static final int ROTATE_NONE
public static final int ROTATE_LEFT
public static final int ROTATE_RIGHT
public IlvVerticalTextIcon(Component component, String label)
IlvVerticalTextIcon
for the specified component
with the specified label
.
It sets the orientation to the default for the string.verifyRotation(java.lang.String, int)
public IlvVerticalTextIcon(Component component, String label, int rotateHint)
IlvVerticalTextIcon
for the specified component
with the specified label
.
It sets the orientation to the provided value if it's legal for the string.
The argument rotateHint
must be one of the following:
ROTATE_DEFAULT
, ROTATE_LEFT
,
ROTATE_NONE
, or ROTATE_RIGHT
.verifyRotation(java.lang.String, int)
public void setLabel(String label)
verifyRotation(java.lang.String, int)
public void propertyChange(PropertyChangeEvent e)
propertyChange
in interface PropertyChangeListener
public void paintIcon(Component c, Graphics g, int x, int y)
public int getIconWidth()
getIconWidth
in interface Icon
public int getIconHeight()
getIconHeight
in interface Icon
public static int verifyRotation(String label, int rotateHint)
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 degrees counterclockwise so that the characters are ordered from top to bottom. Latin text and numbers may be rotated 90 degrees clockwise so that the characters are also ordered from top to bottom.
Rotation rules:
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.
The argument rotateHint
must be one of the following:
ROTATE_DEFAULT
, ROTATE_LEFT
,
ROTATE_NONE
, or ROTATE_RIGHT
.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.