Class JCommandButtonStrip

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.pushingpixels.flamingo.api.common.JCommandButtonStrip
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
BasicRibbonGalleryUI.JButtonStripUIResource

public class JCommandButtonStrip extends JComponent
Button strip component. Provides visual appearance of a strip. The buttons in the strip are either drawn horizontally with no horizontal space between them or drawn vertically with no vertical space between them.
See Also:
  • Field Details

  • Constructor Details

    • JCommandButtonStrip

      public JCommandButtonStrip()
      Creates an empty horizontally-oriented strip.
    • JCommandButtonStrip

      public JCommandButtonStrip(JCommandButtonStrip.StripOrientation orientation)
      Creates an empty strip.
      Parameters:
      orientation - Orientation for this strip.
  • Method Details

    • setDisplayState

      public void setDisplayState(CommandButtonDisplayState elementState)
      Sets the display state for the buttons in this button strip. This method must be called before adding the first command button. The default state is CommandButtonDisplayState.SMALL.
      Parameters:
      elementState - New element state for the buttons in this button strip.
    • setHGapScaleFactor

      public void setHGapScaleFactor(double hgapScaleFactor)
      Sets the horizontal gap scale factor for the buttons in this button strip. This method must be called before adding the first command button.

      The default horizontal gap scale factor for horizontally oriented strips is 0.75. The default horizontal gap scale factor for vertically oriented strips is 1.0.

      Parameters:
      hgapScaleFactor - New horizontal gap scale factor for the buttons in this button strip.
      See Also:
    • setVGapScaleFactor

      public void setVGapScaleFactor(double vgapScaleFactor)
      Sets the vertical gap scale factor for the buttons in this button strip. This method must be called before adding the first command button.

      The default vertical gap scale factor for vertically oriented strips is 0.75. The default vertical gap scale factor for horizontally oriented strips is 1.0.

      Parameters:
      vgapScaleFactor - New vertical gap scale factor for the buttons in this button strip.
      See Also:
    • add

      public void add(Component comp, Object constraints, int index)
      Overrides:
      add in class Container
    • add

      public void add(Component comp, Object constraints)
      Overrides:
      add in class Container
    • add

      public Component add(Component comp, int index)
      Overrides:
      add in class Container
    • add

      public Component add(Component comp)
      Overrides:
      add in class Container
    • add

      public Component add(String name, Component comp)
      Overrides:
      add in class Container
    • setUI

      public void setUI(CommandButtonStripUI ui)
      Sets the new UI delegate.
      Parameters:
      ui - New UI delegate.
    • updateUI

      public void updateUI()
      Resets the UI property to a value from the current look and feel.
      Overrides:
      updateUI in class JComponent
      See Also:
    • getUI

      public CommandButtonStripUI getUI()
      Returns the UI object which implements the Linvalid input: '&F' for this component.
      Overrides:
      getUI in class JComponent
      Returns:
      a ButtonStripUI object
      See Also:
    • getUIClassID

      public String getUIClassID()
      Returns the name of the UI class that implements the Linvalid input: '&F' for this component.
      Overrides:
      getUIClassID in class JComponent
      Returns:
      the string "ButtonStripUI"
      See Also:
    • getButtonCount

      public int getButtonCount()
      Returns the number of buttons in this strip.
      Returns:
      Number of buttons in this strip.
      See Also:
    • getButton

      public AbstractCommandButton getButton(int index)
      Returns the specified button component of this strip.
      Parameters:
      index - Button index.
      Returns:
      The matching button.
      See Also:
    • isFirst

      public boolean isFirst(AbstractCommandButton button)
      Checks whether the specified button is the first button in this strip.
      Parameters:
      button - Button to check.
      Returns:
      true if the specified button is the first button in this strip, false otherwise.
      See Also:
    • isLast

      public boolean isLast(AbstractCommandButton button)
      Checks whether the specified button is the last button in this strip.
      Parameters:
      button - Button to check.
      Returns:
      true if the specified button is the last button in this strip, false otherwise.
      See Also:
    • getOrientation

      public JCommandButtonStrip.StripOrientation getOrientation()
      Returns the orientation of this strip.
      Returns:
      Orientation of this strip.
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Adds the specified change listener to track changes to this command button strip.
      Parameters:
      l - Change listener to add.
      See Also:
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Removes the specified change listener from tracking changes to this command button strip.
      Parameters:
      l - Change listener to remove.
      See Also:
    • fireStateChanged

      protected void fireStateChanged()
      Notifies all registered listener that the state of this command button strip has changed.