public class VerticalLabelUI extends BasicLabelUI
Extends BasicLabelUI
.
The only difference between the appearance of labels in the Basic and Metal L&Fs is the manner in which disabled 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 |
labelUI
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 ComponentUI |
createUI(JComponent c) |
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(FontMetrics, String,
Icon, int, int, int, int, Rectangle, Rectangle, Rectangle, int) |
void |
paint(Graphics g,
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, uninstallUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
protected 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 ComponentUI createUI(JComponent c)
public int getBaseline(JComponent c, int width, int height)
getBaseline
in class BasicLabelUI
ComponentUI.getBaseline(JComponent, int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
in class BasicLabelUI
ComponentUI.getBaselineResizeBehavior(javax.swing.JComponent)
protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
SwingUtilities.layoutCompoundLabel(FontMetrics, String,
Icon, int, int, int, int, Rectangle, Rectangle, Rectangle, int)
layoutCL
in class BasicLabelUI
public void paint(Graphics g, JComponent c)
paint
in class BasicLabelUI
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class BasicLabelUI
ComponentUI.getPreferredSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class BasicLabelUI
ComponentUI.getMaximumSize(javax.swing.JComponent)
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class BasicLabelUI
ComponentUI.getMinimumSize(javax.swing.JComponent)
Copyright © 2005–2020. All rights reserved.