Class WheelSwitch

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
NumberScalarViewer, NumberScalarWheelEditor

public class WheelSwitch extends JComponent
A WheelSwitch editor.
See Also:
  • Constructor Details

    • WheelSwitch

      public WheelSwitch()
      WheelSwitch constructor.
    • WheelSwitch

      public WheelSwitch(boolean editable)
      WheelSwitch constructor.
      Parameters:
      editable - Editable flag
  • Method Details

    • setMinimumIncrement

      public void setMinimumIncrement(double inc)
      Sets the minimum increment. When try to add a value lower than minimumIncrement, minimumIncrement is added.
      Parameters:
      inc - Minimum increment
    • getMinimumIncrement

      public double getMinimumIncrement()
    • setTextBackground

      public void setTextBackground(Color c)
      Sets the text background, null to disable.
      Parameters:
      c - Text background color
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • setValue

      public void setValue(double v)
      Sets the WheelSwitch value.
      Parameters:
      v - New WheelSwitch value.
    • getValue

      public double getValue()
      Returns the current wheelswitch value.
      Returns:
      Current value
    • setFont

      public void setFont(Font f)
      Overrides:
      setFont in class JComponent
    • isGoodFormat

      public boolean isGoodFormat()
    • getDigitSize

      public Dimension getDigitSize()
      Returns:
      the current digit size according the the component Font.
    • setButtonColor

      public void setButtonColor(Color c)
      Sets the color of arrow buttons.
      Parameters:
      c - New button color.
    • getButtonColor

      public Color getButtonColor()
      Returns:
      the current button color.
      See Also:
    • setSelButtonColor

      public void setSelButtonColor(Color c)
      Sets the selected button color.
      Parameters:
      c - Color for selected button.
    • getSelButtonColor

      public Color getSelButtonColor()
      Returns:
      the current button selection color.
    • setMaxValue

      public void setMaxValue(double max)
      Sets the max value. Must be called after setFormat() or setPrecision(). Ingnored if scientific format is used.
      Parameters:
      max - Maximum allowed value
    • setEnabled

      public void setEnabled(boolean arg0)
      Overrides:
      setEnabled in class JComponent
    • setMinValue

      public void setMinValue(double min)
      Sets the min value. Must be called after setFormat() or setPrecision(). Ingnored if scientific format is used.
      Parameters:
      min - Minimum allowed value
    • setFormat

      public void setFormat(String aformat)
    • setFormat

      public void setFormat(String aformat, String attName)
      Set the format as C format (only "%x.yf" or "%xd" is supported). This will change the button configuration.
      Parameters:
      aformat - New wheelswitch format.
      attName - Attribute name
    • setPrecision

      public void setPrecision(int inb, int fnb, int enb)
      Set the precision of this wheelswitch.
      Parameters:
      inb - number of digit for the integer part
      fnb - number of digit for the decimal part
      enb - number of digit for the exponent part
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • addWheelSwitchListener

      public void addWheelSwitchListener(IWheelSwitchListener l)
      Add the specified WheelSwitch Listener.
      Parameters:
      l - WheelSwitch Listener
    • removeWheelSwitchListener

      public void removeWheelSwitchListener(IWheelSwitchListener l)
      Remove the specified WheelSwitch Listener.
      Parameters:
      l - WheelSwitch Listener to be removed
    • setBounds

      public void setBounds(int x, int y, int w, int h)
      Overrides:
      setBounds in class Component
    • main

      public static void main(String[] args)