Class LabeledButtonContainer

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class LabeledButtonContainer extends JPanel
A small compound component that places a centered label below a button.

The button is placed inside a centering panel. This keeps the label from stretching the button horizontally, which is important for drawn/vector buttons whose drawings assume a particular aspect ratio.

See Also:
  • Constructor Details

    • LabeledButtonContainer

      public LabeledButtonContainer(AbstractButton button, String text)
      Creates a labeled button container using the default vertical gap.
      Parameters:
      button - the button to display
      text - the label text
    • LabeledButtonContainer

      public LabeledButtonContainer(AbstractButton button, String text, int verticalGap)
      Creates a labeled button container.
      Parameters:
      button - the button to display
      text - the label text
      verticalGap - the gap, in pixels, between the button and label
  • Method Details

    • getButton

      public AbstractButton getButton()
      Returns the contained button.
      Returns:
      the button
    • getLabelText

      public String getLabelText()
      Returns the label text.
      Returns:
      the label text
    • setLabelText

      public void setLabelText(String text)
      Sets the label text.
      Parameters:
      text - the new label text
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • getFont

      public Font getFont()
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component
    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JPanel
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent