|
|||||||||
| Home >> All >> com >> imagero >> gui >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.imagero.gui.swing
Class VTextIcon

java.lang.Objectcom.imagero.gui.swing.VTextIcon
- All Implemented Interfaces:
- java.util.EventListener, javax.swing.Icon, java.beans.PropertyChangeListener
- public class VTextIcon
- extends java.lang.Object
- implements javax.swing.Icon, java.beans.PropertyChangeListener
- extends java.lang.Object
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)
| Field Summary | |
(package private) static int |
DEFAULT_CJK
|
(package private) static int |
DEFAULT_MUST_ROTATE
|
(package private) static int |
DEFAULT_ROMAN
|
(package private) int |
fCharHeight
|
(package private) java.lang.String[] |
fCharStrings
|
(package private) int[] |
fCharWidths
|
(package private) java.awt.Component |
fComponent
|
(package private) int |
fDescent
|
(package private) int |
fHeight
|
(package private) java.lang.String |
fLabel
|
(package private) int[] |
fPosition
|
(package private) int |
fRotation
|
(package private) int |
fWidth
|
(package private) static int |
kBufferSpace
|
(package private) static int |
LEGAL_MUST_ROTATE
|
(package private) static int |
LEGAL_ROMAN
|
(package private) static double |
NINETY_DEGREES
|
(package private) static int |
POSITION_FAR_TOP_RIGHT
|
(package private) static int |
POSITION_NORMAL
|
(package private) static int |
POSITION_TOP_RIGHT
|
static int |
ROTATE_DEFAULT
|
static int |
ROTATE_LEFT
|
static int |
ROTATE_NONE
|
static int |
ROTATE_RIGHT
|
(package private) static java.lang.String |
sDrawsInFarTopRight
|
(package private) static java.lang.String |
sDrawsInTopRight
|
| Constructor Summary | |
VTextIcon(java.awt.Component component,
java.lang.String label)
Creates a VTextIcon for the specified component
with the specified label. |
|
VTextIcon(java.awt.Component component,
java.lang.String label,
int rotateHint)
Creates a VTextIcon for the specified component
with the specified label. |
|
| Method Summary | |
(package private) void |
calcDimensions()
|
int |
getIconHeight()
Returns the icon's height. |
int |
getIconWidth()
Returns the icon's width. |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Draw the icon at the specified location. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Checks for changes to the font on the fComponent so that it can invalidate the layout if the size changes |
(package private) void |
recalcDimensions()
Calculates the dimensions. |
void |
setLabel(java.lang.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(java.lang.String label,
int rotateHint)
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¡ counterclockwise so that the characters are ordered from top to bottom. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
fLabel
java.lang.String fLabel
fCharStrings
java.lang.String[] fCharStrings
fCharWidths
int[] fCharWidths
fPosition
int[] fPosition
fWidth
int fWidth
fHeight
int fHeight
fCharHeight
int fCharHeight
fDescent
int fDescent
fRotation
int fRotation
fComponent
java.awt.Component fComponent
POSITION_NORMAL
static final int POSITION_NORMAL
- See Also:
- Constant Field Values
POSITION_TOP_RIGHT
static final int POSITION_TOP_RIGHT
- See Also:
- Constant Field Values
POSITION_FAR_TOP_RIGHT
static final int POSITION_FAR_TOP_RIGHT
- See Also:
- Constant Field Values
ROTATE_DEFAULT
public static final int ROTATE_DEFAULT
- See Also:
- Constant Field Values
ROTATE_NONE
public static final int ROTATE_NONE
- See Also:
- Constant Field Values
ROTATE_LEFT
public static final int ROTATE_LEFT
- See Also:
- Constant Field Values
ROTATE_RIGHT
public static final int ROTATE_RIGHT
- See Also:
- Constant Field Values
sDrawsInTopRight
static final java.lang.String sDrawsInTopRight
- See Also:
- Constant Field Values
sDrawsInFarTopRight
static final java.lang.String sDrawsInFarTopRight
- See Also:
- Constant Field Values
DEFAULT_CJK
static final int DEFAULT_CJK
- See Also:
- Constant Field Values
LEGAL_ROMAN
static final int LEGAL_ROMAN
- See Also:
- Constant Field Values
DEFAULT_ROMAN
static final int DEFAULT_ROMAN
- See Also:
- Constant Field Values
LEGAL_MUST_ROTATE
static final int LEGAL_MUST_ROTATE
- See Also:
- Constant Field Values
DEFAULT_MUST_ROTATE
static final int DEFAULT_MUST_ROTATE
- See Also:
- Constant Field Values
NINETY_DEGREES
static final double NINETY_DEGREES
kBufferSpace
static final int kBufferSpace
- See Also:
- Constant Field Values
| Constructor Detail |
VTextIcon
public VTextIcon(java.awt.Component component, java.lang.String label)
- Creates a
VTextIconfor the specifiedcomponentwith the specifiedlabel. It sets the orientation to the default for the string
VTextIcon
public VTextIcon(java.awt.Component component, java.lang.String label, int rotateHint)
- Creates a
VTextIconfor the specifiedcomponentwith the specifiedlabel. It sets the orientation to the provided value if it's legal for the string
| Method Detail |
setLabel
public void setLabel(java.lang.String label)
- sets the label to the given string, updating the orientation as needed
and invalidating the layout if the size changes
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Checks for changes to the font on the fComponent
so that it can invalidate the layout if the size changes
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
recalcDimensions
void recalcDimensions()
- Calculates the dimensions. If they've changed,
invalidates the component
calcDimensions
void calcDimensions()
paintIcon
public void paintIcon(java.awt.Component c, java.awt.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.
- Specified by:
paintIconin interfacejavax.swing.Icon
getIconWidth
public int getIconWidth()
- Returns the icon's width.
- Specified by:
getIconWidthin interfacejavax.swing.Icon
getIconHeight
public int getIconHeight()
- Returns the icon's height.
- Specified by:
getIconHeightin interfacejavax.swing.Icon
verifyRotation
public static int verifyRotation(java.lang.String label, int rotateHint)
- 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¡ 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 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
|
|||||||||
| Home >> All >> com >> imagero >> gui >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.imagero.gui.swing.VTextIcon