Class BaseFlatButtonWithDropDownMenu

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

public class BaseFlatButtonWithDropDownMenu extends BaseFlatButton
Button that opens a dropdown menu when clicked. You can either supply a whole menu or just add menu items/actions that should get displayed.
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

  • Constructor Details

    • BaseFlatButtonWithDropDownMenu

      public BaseFlatButtonWithDropDownMenu()
      Initializes the button. Uses the "arrow-head-down.png" icon.
    • BaseFlatButtonWithDropDownMenu

      public BaseFlatButtonWithDropDownMenu(Icon icon)
      Initializes the button, using the specified icon.
      Parameters:
      icon - the icon for the button
    • BaseFlatButtonWithDropDownMenu

      public BaseFlatButtonWithDropDownMenu(String text, Icon icon)
      Initializes the button, using the specified button text and icon.
      Parameters:
      text - the text for the button
      icon - the icon for the button
  • Method Details

    • initialize

      protected void initialize()
      Initializes the members.
    • clearMenu

      public void clearMenu()
      Removes all supplied menu items. Does not affect a supplied menu.
    • addToMenu

      public void addToMenu(JMenuItem item)
      Adds the menu item for the dropdown menu.
      Parameters:
      item - the item to add
    • addToMenu

      public void addToMenu(Action action)
      Adds the action for the dropdown menu.
      Parameters:
      action - the action to add
    • addSeparatorToMenu

      public void addSeparatorToMenu()
      Adds a separator to the dropdown menu.
    • setDropDownMenu

      public void setDropDownMenu(JPopupMenu menu)
      Sets the menu to display.
      Parameters:
      menu - the menu to use
    • getDropDownMenu

      public JPopupMenu getDropDownMenu()
      Returns the menu to display.
      Returns:
      the menu to use, null if none set
    • showMenu

      protected void showMenu()
      Shows the menu.