Class ImageButton

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

public class ImageButton extends JButton
A button backed by an image. Additionally, a click mask can be provided. Any fully non-transparent pixels in the mask will not be clickable.
See Also:
  • Constructor Details

    • ImageButton

      public ImageButton(Icon icon)
      Creates an image based button.
      Parameters:
      icon - the icon to use for the button.
    • ImageButton

      public ImageButton(Icon icon, Icon mask)
      Creates an image based button with the given click mask.
      Parameters:
      icon - the icon to use for the button.
      mask - the click mask to use for the button.
      Throws:
      IllegalArgumentException - if the given icon is null, the given mask is null or the given mask's bounds do not match the given icons bounds.
  • Method Details