Class CommonToolBar

All Implemented Interfaces:
ActionListener, ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, SwingConstants

public class CommonToolBar extends JToolBar implements ActionListener, ItemListener
See Also:
  • Field Details Link icon

  • Constructor Details Link icon

    • CommonToolBar Link icon

      public CommonToolBar(int orientation)
      Creates a new tool bar with a specified name and orientation. All other constructors call this constructor.
      Parameters:
      orientation - the initial orientation -- it must be either HORIZONTAL or VERTICAL
  • Method Details Link icon

    • setSelectedToggle Link icon

      public void setSelectedToggle(String s)
      Set which toggle buttonis selected
    • getMainButtonGroup Link icon

      public ButtonGroup getMainButtonGroup()
      Get the primary button group so that we can add other buttons to the group
      Returns:
      the primary button group so that we can add other buttons to the group
    • add Link icon

      public void add(ToolBarButton button)
      Add a regular button to the toolbar
      Parameters:
      button - the ToolBarButton to add.
    • add Link icon

      public void add(JToggleButton toggleButton)
      Add a toggle button to the toolbar.
      Parameters:
      toggleButton - the button to add.
    • add Link icon

      public void add(JToggleButton toggleButton, boolean toGroup)
      Add a toggle button to the toolbar.
      Parameters:
      toggleButton - the button to add.
      toGroup - if true and to the primary button group
    • remove Link icon

      public void remove(JToggleButton toggleButton)
      remove a toggle button from the toolbar.
      Parameters:
      toggleButton - the button to remove.
    • getDefaultToggleButton Link icon

      public JToggleButton getDefaultToggleButton()
      Get the default toggle button. This will become active if you click an active toggle button to turn it off.
      Returns:
      the default toggle buton.
    • setDefaultToggleButton Link icon

      public void setDefaultToggleButton(ToolBarToggleButton defaultToggleButton)
      Set the default toggle button. This will become active if you click an active toggle button to turn it off.
      Parameters:
      defaultToggleButton - the default toggle button.
    • resetDefaultSelection Link icon

      public void resetDefaultSelection()
      Reset the default toggle button selection
    • getActiveCommand Link icon

      public String getActiveCommand()
      Get the command of the active toggle button
      Returns:
      the command of the active toggle button
    • getActiveButton Link icon

      public ToolBarToggleButton getActiveButton()
      Get which tool bar toggle button from the primary button group is active
      Returns:
      the active toolbar toggle button (from the primary button group), or null.
    • isDefaultActivated Link icon

      public boolean isDefaultActivated()
      Check whether the default button is active
      Returns:
      true if the default button is active.
    • isButtonActivated Link icon

      public boolean isButtonActivated(AbstractButton tbtb)
      Check whether a given button is active
      Parameters:
      tbtb - the button to test
      Returns:
      true if the default button is active.
    • addToolBarListener Link icon

      public void addToolBarListener(IToolBarListener listener)
      Add a toolBar listener
      Parameters:
      ToolBarListener - the listener to add
    • removeToolBarListener Link icon

      public void removeToolBarListener(IToolBarListener listener)
      Remove a ToolBarListener.
      Parameters:
      ToolBarListener - the ToolBarListener to remove.
    • actionPerformed Link icon

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • itemStateChanged Link icon

      public void itemStateChanged(ItemEvent e)
      Specified by:
      itemStateChanged in interface ItemListener
    • getButton Link icon

      public AbstractButton getButton(String actionCommand)
      Find a button from the action command
      Parameters:
      actionCommand - the action command to match
      Returns:
      the button or null if not found
    • setButtonEnabled Link icon

      public void setButtonEnabled(String actionCommand, boolean enabled)
      Set a button enabled by the action command
      Parameters:
      actionCommand - the action command
      enabled - the flag