Class ThreeStateSwitch

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
fr.esrf.tangoatk.widget.util.ThreeStateSwitch
All Implemented Interfaces:
MouseListener, ImageObserver, MenuContainer, Serializable, EventListener
Direct Known Subclasses:
OnOffSwitchCommandViewer, ThreeStateSwitchCommandViewer

public class ThreeStateSwitch extends JComponent implements MouseListener
See Also:
  • Field Details

  • Constructor Details

    • ThreeStateSwitch

      public ThreeStateSwitch()
      Construct a ThreeStateSwitch with no title and default icons.
    • ThreeStateSwitch

      public ThreeStateSwitch(String title, Font tFont)
      Construct a ThreeStateSwitch with the specified title and font.
      Parameters:
      title - Title
      tFont - Title font
  • Method Details

    • setTitle

      public void setTitle(String s)
      Sets the title off this components
      Parameters:
      s - Title to display or null
    • getTitle

      public String getTitle()
      Returns the title of this component
      Returns:
      Component title
    • setFont

      public void setFont(Font f)
      Sets the font of this component
      Overrides:
      setFont in class JComponent
      Parameters:
      f - Font
    • getFont

      public Font getFont()
      Returns current font
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component
      Returns:
      Font
    • setIcons

      public void setIcons(ImageIcon on, ImageIcon off, ImageIcon unknown)
      Sets icons fot the switch.
      Parameters:
      on - ON icon
      off - OFF icon
      unknown - UNKNOWN icon
    • setState

      public void setState(int s)
      Sets the state.
      Parameters:
      s - One of the following ThreeStateSwitch.UNKNOWN_STATE ThreeStateSwitch.ON_STATE ThreeStateSwitch.OFF_STATE
    • getState

      public int getState()
      Returns the state of this component
      Returns:
      State
    • addActionListener

      public void addActionListener(ActionListener l)
      Adds the specified action listener
      Parameters:
      l - Listener to add
    • removActionListener

      public void removActionListener(ActionListener l)
      Removes the specified action listener
      Parameters:
      l - Listener to remove
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • getPreferredSize

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

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent