public class VerticalLabelUI
extends javax.swing.plaf.basic.BasicLabelUI
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.
| Modifier and Type | Field and Description |
|---|---|
protected static VerticalLabelUI |
verticalLabelUI |
| Constructor and Description |
|---|
VerticalLabelUI()
Constructs a
VerticalLabelUI with the default anticlockwise
rotation |
VerticalLabelUI(boolean clockwise)
Constructs a
VerticalLabelUI with the desired rotation. |
| Modifier and Type | Method and Description |
|---|---|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c) |
int |
getBaseline(javax.swing.JComponent c,
int width,
int height)
Overridden to always return -1, since a vertical label does not have a
meaningful baseline.
|
java.awt.Component.BaselineResizeBehavior |
getBaselineResizeBehavior(javax.swing.JComponent c)
Overridden to always return Component.BaselineResizeBehavior.OTHER,
since a vertical label does not have a meaningful baseline
|
java.awt.Dimension |
getMaximumSize(javax.swing.JComponent c)
Returns a Dimension appropriate for vertical rendering
|
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent c)
Returns a Dimension appropriate for vertical rendering
|
java.awt.Dimension |
getPreferredSize(javax.swing.JComponent c)
Returns a Dimension appropriate for vertical rendering
|
protected java.lang.String |
layoutCL(javax.swing.JLabel label,
java.awt.FontMetrics fontMetrics,
java.lang.String text,
javax.swing.Icon icon,
java.awt.Rectangle viewR,
java.awt.Rectangle iconR,
java.awt.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(FontMetrics, String,
Icon, int, int, int, int, Rectangle, Rectangle, Rectangle, int) |
void |
paint(java.awt.Graphics g,
javax.swing.JComponent c)
Transforms the Graphics for vertical rendering and invokes the
super method.
|
installComponents, installDefaults, installKeyboardActions, installListeners, installUI, paintDisabledText, paintEnabledText, propertyChange, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUIprotected static VerticalLabelUI verticalLabelUI
public VerticalLabelUI()
VerticalLabelUI with the default anticlockwise
rotationpublic VerticalLabelUI(boolean clockwise)
VerticalLabelUI with the desired rotation.
clockwise - true to rotate clockwise, false for anticlockwisepublic static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
ComponentUI.createUI(javax.swing.JComponent)public int getBaseline(javax.swing.JComponent c,
int width,
int height)
getBaseline in class javax.swing.plaf.basic.BasicLabelUIComponentUI.getBaseline(JComponent, int, int)public java.awt.Component.BaselineResizeBehavior getBaselineResizeBehavior(javax.swing.JComponent c)
getBaselineResizeBehavior in class javax.swing.plaf.basic.BasicLabelUIComponentUI.getBaselineResizeBehavior(javax.swing.JComponent)protected java.lang.String layoutCL(javax.swing.JLabel label,
java.awt.FontMetrics fontMetrics,
java.lang.String text,
javax.swing.Icon icon,
java.awt.Rectangle viewR,
java.awt.Rectangle iconR,
java.awt.Rectangle textR)
SwingUtilities.layoutCompoundLabel(FontMetrics, String,
Icon, int, int, int, int, Rectangle, Rectangle, Rectangle, int)layoutCL in class javax.swing.plaf.basic.BasicLabelUIpublic void paint(java.awt.Graphics g,
javax.swing.JComponent c)
paint in class javax.swing.plaf.basic.BasicLabelUIpublic java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize in class javax.swing.plaf.basic.BasicLabelUIComponentUI.getPreferredSize(javax.swing.JComponent)public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
getMaximumSize in class javax.swing.plaf.basic.BasicLabelUIComponentUI.getMaximumSize(javax.swing.JComponent)public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
getMinimumSize in class javax.swing.plaf.basic.BasicLabelUIComponentUI.getMinimumSize(javax.swing.JComponent)