Package rma.swing

Class RmaJLabel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, TimeZoneComponent, UnitsComponent

public class RmaJLabel extends JLabel implements UnitsComponent, TimeZoneComponent
RmaJLabel subclasses javax.swing.JLabel in order to display unit strings. The programmer has to add the template "%S" or "%L" to the string label and the label will replace it with the appropriate units string label
Since:
Decmeber 11, 2000
See Also:
  • Field Details

  • Constructor Details

    • RmaJLabel

      public RmaJLabel(String text, Icon icon, int horizontalAlignment)
      Creates a JLabel instance with the specified text, image, and horizontal alignment. The label is centered vertically in its display area. The text is on the trailing edge of the image.
      Parameters:
      text - The text to be displayed by the label.
      icon - The image to be displayed by the label.
      horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
    • RmaJLabel

      public RmaJLabel(String text, int horizontalAlignment)
      Creates a RmaJLabel instance with the specified text and horizontal alignment. The label is centered vertically in its display area.
      Parameters:
      text - The text to be displayed by the label.
      horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
    • RmaJLabel

      public RmaJLabel(String text)
      Creates a RmaJLabel instance with the specified text. The label is aligned against the leading edge of its display area, and centered vertically.
      Parameters:
      text - The text to be displayed by the label.
    • RmaJLabel

      public RmaJLabel(Icon image, int horizontalAlignment)
      Creates a RmaJLabel instance with the specified image and horizontal alignment. The label is centered vertically in its display area.
      Parameters:
      image - The image to be displayed by the label.
      horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
    • RmaJLabel

      public RmaJLabel(Icon image)
      Creates a RmaJLabel instance with the specified image. The label is centered vertically and horizontally in its display area.
      Parameters:
      image - The image to be displayed by the label.
    • RmaJLabel

      public RmaJLabel()
      Creates a RmaJLabel instance with no image and with an empty string for the title. The label is centered vertically in its display area. The label's contents, once set, will be displayed on the leading edge of the label's display area.
    • RmaJLabel

      public RmaJLabel(String text, HecTime time, TimeZone dataTimeZone, String dateFmt)
  • Method Details

    • setTime

      public void setTime(HecTime time)
    • paint

      public void paint(Graphics g)
      Overrided the paint method in the JCommponent so we can do some specific updating of the label before the label is painted
      Overrides:
      paint in class JComponent
    • setTemplateLabel

      public void setTemplateLabel(String text)
    • setText

      public void setText(String text)
      Overrides:
      setText in class JLabel
    • setDisplayScaleFactor

      public void setDisplayScaleFactor(int paramId, double scaleFactor)
      Description copied from interface: UnitsComponent
      Sets a scaling factor to use when displaying the data.
      Specified by:
      setDisplayScaleFactor in interface UnitsComponent
      Parameters:
      paramId - This is the identifier of the paramater to scale. If the data is not of this type then it is ignored
      scaleFactor - This is the scaling factor *to* be multiplied to the value when it is rendered
    • getDisplayUnitSystem

      public int getDisplayUnitSystem()
    • setDisplayUnitsSystem

      public void setDisplayUnitsSystem(int unitSystem)
      Description copied from interface: UnitsComponent
      Sets the current Unit System for this object
      Specified by:
      setDisplayUnitsSystem in interface UnitsComponent
    • getTemplateLabel

      public String getTemplateLabel()
    • replaceUnitsTemplate

      public static String replaceUnitsTemplate(String template, String unitsLbl)
    • getDisplayUnitsString

      public String getDisplayUnitsString(int unitSystem)
      Description copied from interface: UnitsComponent
      This method allows the retrieves the units string for a given units system
      Specified by:
      getDisplayUnitsString in interface UnitsComponent
      See Also:
    • setDataTimeZone

      public void setDataTimeZone(TimeZone tz)
    • setTimeZone

      public void setTimeZone(TimeZone tz)
      Sets the time zone that this component will use to display date and time.
      Specified by:
      setTimeZone in interface TimeZoneComponent
      Parameters:
      tz - The time zone to use for display purposes
    • getTimeZone

      public TimeZone getTimeZone()
      Gets the Time Zone that this component is using to display a date and time.
      Specified by:
      getTimeZone in interface TimeZoneComponent
      Returns:
      java.util.TimeZone
    • main

      public static void main(String[] args)