Class 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)
      • Fields inherited from class javax.swing.plaf.basic.BasicLabelUI

        labelUI
    • Constructor Summary

      Constructors 
      Constructor Description
      VerticalLabelUI()
      Default constructor which provides a vertical label with anti-clockwise orientation
      VerticalLabelUI​(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
      • Methods inherited from class javax.swing.plaf.ComponentUI

        contains, getAccessibleChild, getAccessibleChildrenCount, update
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 or
        ANTICLOCKWISE
    • Method Detail

      • getPreferredSize

        public java.awt.Dimension getPreferredSize​(javax.swing.JComponent component)
        Overrides:
        getPreferredSize in class javax.swing.plaf.basic.BasicLabelUI
      • paint

        public void paint​(java.awt.Graphics graphics,
                          javax.swing.JComponent component)
        Overrides:
        paint in class javax.swing.plaf.basic.BasicLabelUI