|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.LabelUI
javax.swing.plaf.basic.BasicLabelUI
com.wordpress.tipsforjava.swing.plaf.VerticalLabelUI
public class VerticalLabelUI extends BasicLabelUI
A UI delegate for JLabel that rotates the label 90 degrees
Extends BasicLabelUI.
The only difference between the appearance of labels in the Basic and Metal L&Fs is the manner in which diabled text is painted. As VerticalLabelUI does not override the method paintDisabledText, this class can be adapted for Metal L&F by extending MetalLabelUI instead of BasicLabelUI.
No other changes are required.
| Field Summary | |
|---|---|
private static VerticalLabelUI |
SAFE_VERTICAL_LABEL_UI
|
private boolean |
clockwise
|
Rectangle |
verticalIconR
|
protected static VerticalLabelUI |
verticalLabelUI
|
Rectangle |
verticalTextR
|
Rectangle |
verticalViewR
|
| Constructor Summary | |
VerticalLabelUI()
Constructs a |
|
VerticalLabelUI(boolean clockwise)
Constructs a |
|
| Method Summary | |
|---|---|
private Rectangle
|
copyRectangle(Rectangle from, Rectangle to)
|
static ComponentUI
|
createUI(JComponent c)
@see ComponentUI#createUI(javax.swing.JComponent) |
int
|
getBaseline(JComponent c, int width, int height)
Overridden to always return -1, since a vertical label does not have a meaningful baseline. |
Component.BaselineResizeBehavior
|
getBaselineResizeBehavior(JComponent c)
Overridden to always return Component.BaselineResizeBehavior.OTHER, since a vertical label does not have a meaningful baseline |
Dimension
|
getMaximumSize(JComponent c)
Returns a Dimension appropriate for vertical rendering |
Dimension
|
getMinimumSize(JComponent c)
Returns a Dimension appropriate for vertical rendering |
Dimension
|
getPreferredSize(JComponent c)
Returns a Dimension appropriate for vertical rendering |
protected String
|
layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
Transposes the view rectangles as appropriate for a vertical view before invoking the super method and copies them after they have been altered by SwingUtilities.layoutCompoundLabel |
void
|
paint(Graphics g, JComponent c)
Transforms the Graphics for vertical rendering and invokes the super method. |
private Dimension
|
transposeDimension(Dimension from)
|
private Rectangle
|
transposeRectangle(Rectangle from, Rectangle to)
|
| Methods inherited from class BasicLabelUI | |
|---|---|
| getPreferredSize, getMinimumSize, getMaximumSize, paint, getBaseline, getBaselineResizeBehavior, installUI, uninstallUI, propertyChange, createUI, contains, update, getAccessibleChildrenCount, getAccessibleChild, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Methods inherited from class LabelUI | |
|---|---|
| contains, update, getPreferredSize, getMinimumSize, getMaximumSize, paint, getAccessibleChildrenCount, getAccessibleChild, getBaseline, getBaselineResizeBehavior, installUI, uninstallUI, createUI, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private static final VerticalLabelUI SAFE_VERTICAL_LABEL_UI
private boolean clockwise
Rectangle verticalIconR
protected static VerticalLabelUI verticalLabelUI
Rectangle verticalTextR
Rectangle verticalViewR
| Constructor Detail |
|---|
public VerticalLabelUI()
VerticalLabelUI with the default anticlockwise
rotation
public VerticalLabelUI(boolean clockwise)
VerticalLabelUI with the desired rotation.
clockwise - true to rotate clockwise, false for anticlockwise
| Method Detail |
|---|
private Rectangle copyRectangle(Rectangle from, Rectangle to)
public static ComponentUI createUI(JComponent c)
@Override public int getBaseline(JComponent c, int width, int height)
@Override public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
@Override public Dimension getMaximumSize(JComponent c)
@Override public Dimension getMinimumSize(JComponent c)
@Override public Dimension getPreferredSize(JComponent c)
@Override protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
@Override public void paint(Graphics g, JComponent c)
private Dimension transposeDimension(Dimension from)
private Rectangle transposeRectangle(Rectangle from, Rectangle to)
Groovy Documentation