Class WebbButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
WebbBackButton

public class WebbButton extends JButton
See Also:
  • Constructor Details

    • WebbButton

      public WebbButton(String text, WebbButton.ClickListener clickListener)
      Creates a new WebbButton with the given text.
      Parameters:
      text - The text to display on the button.
      clickListener - The action to perform when the button is clicked.
    • WebbButton

      public WebbButton(String text, BufferedImage imageIn, int width, int height, WebbButton.ClickListener clickListener)
      Creates a new WebbButton with the given text and image.
      Parameters:
      text -
      imageIn -
      width -
      height -
      clickListener -
    • WebbButton

      public WebbButton(BufferedImage imageIn, int width, int height, WebbButton.ClickListener clickListener)
      Creates a new WebbButton with the given image.
      Parameters:
      imageIn - The image to display on the button.
      width - The width of the image / button.
      height - The height of the image / button.
      clickListener - The action to perform when the button is clicked.
    • WebbButton

      public WebbButton(WebbButton.ClickListener clickListener)
      Creates a new blank WebbBackButton.
      Parameters:
      clickListener - The action to perform when the button is clicked.
  • Method Details

    • setClickReleaseListener

      public void setClickReleaseListener(WebbButton.ClickReleaseListener clickReleaseListener)
      Sets the action to perform when the button is released.
      Parameters:
      clickReleaseListener - The action to perform when the button is released.
    • setBorderSize

      public void setBorderSize(int borderSize)
      Sets the size of the border around the button.
      Parameters:
      borderSize - The size of the border.
    • setTextColor

      public void setTextColor(Color textColor)
      Sets the color of the text on the button.
      Parameters:
      textColor - The color of the text.
    • setImage

      public void setImage(BufferedImage image)
      Sets the image of the button.
      Parameters:
      image - The image to display on the button.
    • setDrawBackground

      public void setDrawBackground(boolean drawBackground)
      Sets whether or not the button should draw a background.
      Parameters:
      drawBackground - Whether or not to draw a background.
    • setBackgroundColor

      public void setBackgroundColor(Color backgroundColor)
      Sets the background color of the button.
      Parameters:
      backgroundColor - The color of the background.
    • setFont

      public void setFont(Font font)
      Sets the font of the text on the button.
      Overrides:
      setFont in class JComponent
      Parameters:
      font - The font of the text.
    • getFont

      public Font getFont()
      Returns the font of the text on the button.
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component
      Returns:
      The font of the text.
    • setText

      public void setText(String text)
      Sets the text of the button.
      Overrides:
      setText in class AbstractButton
      Parameters:
      text - The text to display on the button.
    • getText

      public String getText()
      Returns the text of the button.
      Overrides:
      getText in class AbstractButton
      Returns:
      The text of the button.
    • paint

      public void paint(Graphics g)
      Paints the button.
      Overrides:
      paint in class JComponent
      Parameters:
      g - the Graphics context in which to paint