Class Wheelswitch

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Wheelswitch extends JPanel
Descendant of javax.swing.JPanel that contains a row of digits and optionally a two way up-down button. It can be used for displaying and modifying a single formatted double value with an optional unit string (also in digits) displayed next to the value. Value manipulation and display formatting is handled by the WheelswitchFormatter.
Version:
$id$
Author:
Jernej Kamenik
See Also:
  • Field Details

  • Constructor Details

    • Wheelswitch

      public Wheelswitch(String newFormat, double newValue, String newUnit)
      Constructor for Wheelswitch creates a new Wheelswitch with the specified value, format and unit. No minimum or maximum values are set.
      Parameters:
      newFormat -
      newValue -
      newUnit -
    • Wheelswitch

      public Wheelswitch(double newValue)
      Constructor for Wheelswitch setting only the value. No format or unit are set.
      Parameters:
      newValue -
      See Also:
    • Wheelswitch

      public Wheelswitch()
      Constructor for Wheelswitch which sets no format or unit and the value is set to zero.
      See Also:
  • Method Details

    • setEditable

      public void setEditable(boolean newEditable)
      Sets the editability of the wheelswitch.
      Parameters:
      newEditable -
    • isEditable

      public boolean isEditable()
      Returns whether the wheelswitch can be edited by the user.
      Returns:
      boolean
    • setEnhanced

      public void setEnhanced(boolean enhanced)
      Sets the enhanced property of the wheelswitch. When enhanced the wheelswitch animates its digits when changing the value displayed.
      See Also:
    • isEnhanced

      public boolean isEnhanced()
      Gets the enhancement mode of the Wheelswitch.
      Returns:
      DOCUMENT ME!
    • setFormat

      public void setFormat(String newFormat)
      Sets the format of the value display. Format style is Wheelswitch specific.
      Parameters:
      newFormat -
      Throws:
      NullPointerException - DOCUMENT ME!
      See Also:
    • getFormat

      public String getFormat()
      Gets the format of the display.
      Returns:
      java.lang.String
      See Also:
    • setGraphMax

      public void setGraphMax(double newValue)
      Sets the maximum allowed value.
      Parameters:
      newValue -
      See Also:
    • getGraphMax

      public double getGraphMax()
      Gets the maximum alowed value.
      Returns:
      double
      See Also:
    • setGraphMin

      public void setGraphMin(double newValue)
      Sets the minimum allowed value.
      Parameters:
      newValue -
      See Also:
    • getGraphMin

      public double getGraphMin()
      Gets the minimum alowed value.
      Returns:
      double
      See Also:
    • setMaxMin

      public void setMaxMin(double max, double min)
      Sets the maximum and minimum allowed values.
      Parameters:
      max -
      min -
    • getMinimumSize

      public Dimension getMinimumSize()
      This method has been overriden to implement correct layout and resizing features.
      Overrides:
      getMinimumSize in class JComponent
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize()
      This method has been overriden to implement correct layout and resizing features.
      Overrides:
      getPreferredSize in class JComponent
      See Also:
    • setTiltingEnabled

      public void setTiltingEnabled(boolean b)
      Sets the tilitng enabled property.
      Parameters:
      b - whether the component should tilt when value is out of bounds.
    • isTiltingEnabled

      public boolean isTiltingEnabled()
      Returns whether the component should indicate value out of bounds condition by visually tilting its border.
      Returns:
      boolean
    • setUnit

      public void setUnit(String newUnit)
      Sets the unit to be displayed next to the value.
      Parameters:
      newUnit -
      See Also:
    • getUnit

      public String getUnit()
      Gets the unit displayed next to the value.
      Returns:
      java.lang.String
      See Also:
    • setValue

      public void setValue(double newValue)
      Sets the value and displays it in the wheelswitch. The method may also change the current digit selection if neccessary in order to point to the same decimal digit of the displayed value.
      Parameters:
      newValue -
      See Also:
    • getValue

      public double getValue()
      Gets the value displayed by the Wheelswitch and stored by the formatter.
      Returns:
      double
      See Also:
    • setEnabled

      public void setEnabled(boolean arg0)
      Overriden to implement digit and upDownButton enabling/disabling.
      Overrides:
      setEnabled in class JComponent
      See Also:
    • setMaximumDigits

      public void setMaximumDigits(int bound)
      Sets the maximum number of value digits allowed to be displayed in the wheelswitch. The default value is 0 and is ignored.
      Parameters:
      bound - is ignored if less or equal zero.
    • setDigitValue

      protected void setDigitValue(int i, int newValue)
    • setSelectedDigit

      protected void setSelectedDigit(int i)
    • getSelectedDigit

      protected int getSelectedDigit()
    • initDigits

      protected void initDigits()