Package cnuphys.splot.plot
Class VerticalLabelUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.LabelUI
javax.swing.plaf.basic.BasicLabelUI
cnuphys.splot.plot.VerticalLabelUI
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener
A UI delegate for JLabel that rotates the label 90 deg
 
 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.
- Author:
- Darryl
- 
Field SummaryFieldsFields inherited from class javax.swing.plaf.basic.BasicLabelUIlabelUI
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs aVerticalLabelUIwith the default anticlockwise rotationVerticalLabelUI(boolean clockwise) Constructs aVerticalLabelUIwith the desired rotation.
- 
Method SummaryModifier and TypeMethodDescriptionstatic ComponentUIintgetBaseline(JComponent c, int width, int height) Overridden to always return -1, since a vertical label does not have a meaningful baseline.Overridden to always return Component.BaselineResizeBehavior.OTHER, since a vertical label does not have a meaningful baselineReturns a Dimension appropriate for vertical renderingReturns a Dimension appropriate for vertical renderingReturns a Dimension appropriate for vertical renderingprotected StringlayoutCL(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 bySwingUtilities#layoutCompoundLabel(FontMetrics, String, Icon, int, int, int, int, Rectangle, Rectangle, Rectangle, int)voidpaint(Graphics g, JComponent c) Transforms the Graphics for vertical rendering and invokes the super method.Methods inherited from class javax.swing.plaf.basic.BasicLabelUIinstallComponents, installDefaults, installKeyboardActions, installListeners, installUI, paintDisabledText, paintEnabledText, propertyChange, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUIMethods inherited from class javax.swing.plaf.ComponentUIcontains, getAccessibleChild, getAccessibleChildrenCount, update
- 
Field Details- 
verticalLabelUI
 
- 
- 
Constructor Details- 
VerticalLabelUIpublic VerticalLabelUI()Constructs aVerticalLabelUIwith the default anticlockwise rotation
- 
VerticalLabelUIpublic VerticalLabelUI(boolean clockwise) Constructs aVerticalLabelUIwith the desired rotation.- Parameters:
- clockwise- true to rotate clockwise, false for anticlockwise
 
 
- 
- 
Method Details- 
createUI
- 
getBaselineOverridden to always return -1, since a vertical label does not have a meaningful baseline.- Overrides:
- getBaselinein class- BasicLabelUI
- See Also:
 
- 
getBaselineResizeBehaviorOverridden to always return Component.BaselineResizeBehavior.OTHER, since a vertical label does not have a meaningful baseline- Overrides:
- getBaselineResizeBehaviorin class- BasicLabelUI
- See Also:
 
- 
layoutCLprotected 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 bySwingUtilities#layoutCompoundLabel(FontMetrics, String, Icon, int, int, int, int, Rectangle, Rectangle, Rectangle, int)- Overrides:
- layoutCLin class- BasicLabelUI
 
- 
paintTransforms the Graphics for vertical rendering and invokes the super method.- Overrides:
- paintin class- BasicLabelUI
 
- 
getPreferredSizeReturns a Dimension appropriate for vertical rendering- Overrides:
- getPreferredSizein class- BasicLabelUI
- See Also:
 
- 
getMaximumSizeReturns a Dimension appropriate for vertical rendering- Overrides:
- getMaximumSizein class- BasicLabelUI
- See Also:
 
- 
getMinimumSizeReturns a Dimension appropriate for vertical rendering- Overrides:
- getMinimumSizein class- BasicLabelUI
- See Also:
 
 
-