Package jmri.util.swing
Class VerticalLabelUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.LabelUI
-
- javax.swing.plaf.basic.BasicLabelUI
-
- jmri.util.swing.VerticalLabelUI
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
public class VerticalLabelUI extends javax.swing.plaf.basic.BasicLabelUI
Allows a JLabel to be displayed vertically, with a defined orientation. Usage (for a vertical label with anti-clockwise orientation):
JLabel label = new JLabel("Vertical Label");
label.setUI(new VerticalLabelUI(VerticalLabelUI.ANTICLOCKWISE));
This file is part of JMRI.JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ANTICLOCKWISE
Define Anti-Clockwise rotation (-90 degrees from horizontal)static int
CLOCKWISE
Define Clockwise rotation (+90 degrees from horizontal)
-
Constructor Summary
Constructors Constructor Description VerticalLabelUI()
Default constructor which provides a vertical label with anti-clockwise orientationVerticalLabelUI(int rotation)
Constructor used to provide a vertical label of the specified orientation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Dimension
getPreferredSize(javax.swing.JComponent component)
void
paint(java.awt.Graphics graphics, javax.swing.JComponent component)
-
Methods inherited from class javax.swing.plaf.basic.BasicLabelUI
createUI, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, layoutCL, paintDisabledText, paintEnabledText, propertyChange, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
-
-
-
-
Field Detail
-
CLOCKWISE
public static final int CLOCKWISE
Define Clockwise rotation (+90 degrees from horizontal)- See Also:
- Constant Field Values
-
ANTICLOCKWISE
public static final int ANTICLOCKWISE
Define Anti-Clockwise rotation (-90 degrees from horizontal)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VerticalLabelUI
public VerticalLabelUI()
Default constructor which provides a vertical label with anti-clockwise orientation
-
VerticalLabelUI
public VerticalLabelUI(int rotation)
Constructor used to provide a vertical label of the specified orientation- Parameters:
rotation
- defines the rotation:CLOCKWISE
orANTICLOCKWISE
-
-
Method Detail
-
getPreferredSize
public java.awt.Dimension getPreferredSize(javax.swing.JComponent component)
- Overrides:
getPreferredSize
in classjavax.swing.plaf.basic.BasicLabelUI
-
paint
public void paint(java.awt.Graphics graphics, javax.swing.JComponent component)
- Overrides:
paint
in classjavax.swing.plaf.basic.BasicLabelUI
-
-