Class BaseSplitButton

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class BaseSplitButton extends BasePanel
Simple version of a split button: button + drop-down menu.
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

  • Constructor Details

    • BaseSplitButton

      public BaseSplitButton()
      Creates a button with no set text or icon.
    • BaseSplitButton

      public BaseSplitButton(Icon icon)
      Creates a button with an icon.
      Parameters:
      icon - the Icon image to display on the button
    • BaseSplitButton

      public BaseSplitButton(String text)
      Creates a button with text.
      Parameters:
      text - the text of the button
    • BaseSplitButton

      public BaseSplitButton(Action a)
      Creates a button where properties are taken from the Action supplied.
      Parameters:
      a - the Action used to specify the new button
      Since:
      1.3
    • BaseSplitButton

      public BaseSplitButton(String text, Icon icon)
      Creates a button with initial text and an icon.
      Parameters:
      text - the text of the button
      icon - the Icon image to display on the button
  • Method Details

    • initGUI

      protected void initGUI()
      Initializes the widgets.
      Overrides:
      initGUI in class BasePanel
    • setText

      public void setText(String value)
      Sets the text for the main button.
      Parameters:
      value - the text
    • getText

      public String getText()
      Returns the text of the main button.
      Returns:
      the text
    • setIcon

      public void setIcon(Icon value)
      Sets the icon for the main button.
      Parameters:
      value - the icon
    • getIcon

      public Icon getIcon()
      Returns the icon of the main button.
      Returns:
      the icon
    • setAction

      public void setAction(Action value)
      Sets the action for the main button.
      Parameters:
      value - the action to use
    • getAction

      public Action getAction()
      Returns the action of the main button.
      Returns:
      the action in use, can be null
    • add

      public void add(Action value)
      Adds the menu action.
      Parameters:
      value - the action to add
    • add

      public void add(JMenuItem value)
      Adds the menu item.
      Parameters:
      value - the item to add
    • addSeparator

      public void addSeparator()
      Adds a menu separator.
    • isButtonEnabled

      public boolean isButtonEnabled()
      Returns the state of the button part of the JideSplitButton. True if the button is enabled, false if it's not.
      Returns:
      true if the button is enabled, otherwise false
    • setButtonEnabled

      public void setButtonEnabled(boolean value)
      Sets the state of the button part of the JideSplitButton.
      Parameters:
      value - true if the button is enabled, otherwise false
    • isAlwaysDropdown

      public boolean isAlwaysDropdown()
      Only for backwards compatibility with old JideSplitButton.
      Returns:
      always false
    • setAlwaysDropdown

      public void setAlwaysDropdown(boolean alwaysDropdown)
      Only for backwards compatibility with old JideSplitButton.
      Parameters:
      alwaysDropdown - ignored
    • setEnabled

      public void setEnabled(boolean value)
      Sets the enabled state.
      Overrides:
      setEnabled in class JComponent
      Parameters:
      value - whether enabled or not
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Adds the change listener to the menu button.
      Parameters:
      l - the listener to add
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Removes the change listener from the menu button.
      Parameters:
      l - the listener to remove