Class AndButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

public class AndButton extends JButton
Button used for selecting between And and Or semantics for combining search terms.

Note that the isAnd() method is used to test its state, not isSelected. Listeners for this state should use addAndListener(java.awt.event.ActionListener) not addActionListener.

Since:
30 Jun 2015
Author:
Mark Taylor
See Also:
  • Constructor Details

    • AndButton

      public AndButton(boolean isAnd)
      Constructor.
      Parameters:
      isAnd - initial state
  • Method Details

    • isAnd

      public boolean isAnd()
      Returns state.
      Returns:
      true for AND, false for OR
    • setAnd

      public void setAnd(boolean isAnd)
      Sets state.
      Parameters:
      isAnd - true for AND, false for OR
    • addAndListener

      public void addAndListener(ActionListener l)
      Add a listener for changes to the toggle state of this button.
      Parameters:
      l - listener to add
    • removeAndListener

      public void removeAndListener(ActionListener l)
      Remove a listener added by addAndListener.
      Parameters:
      l - listener to remove
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent