Package resources

Class MultiIconBuilder


  • public class MultiIconBuilder
    extends java.lang.Object
    A builder to allow for easier creation of an icon that is composed of a base icon, with other icons overlayed. The build() method returns an ImageIcon, as this allows Java's buttons to create analogue disabled icons correctly.

    Note: this class is a work-in-progress. Add more methods for locating overlays as needed.

    • Constructor Summary

      Constructors 
      Constructor Description
      MultiIconBuilder​(javax.swing.Icon baseIcon)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MultiIconBuilder addLowerLeftIcon​(javax.swing.Icon icon)
      Adds the given icon as an overlay to the base icon, to the lower-left
      MultiIconBuilder addLowerLeftIcon​(javax.swing.Icon icon, int w, int h)
      Adds the given icon as an overlay to the base icon, to the lower-left, scaled to the given width and height
      MultiIconBuilder addLowerRightIcon​(javax.swing.Icon icon)
      Adds the given icon as an overlay to the base icon, to the lower-right
      MultiIconBuilder addLowerRightIcon​(javax.swing.Icon icon, int w, int h)
      Adds the given icon as an overlay to the base icon, to the lower-right, scaled to the given width and height
      javax.swing.ImageIcon build()  
      MultiIconBuilder setDescription​(java.lang.String description)
      Sets a description for the icon being built.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultiIconBuilder

        public MultiIconBuilder​(javax.swing.Icon baseIcon)
    • Method Detail

      • addLowerRightIcon

        public MultiIconBuilder addLowerRightIcon​(javax.swing.Icon icon)
        Adds the given icon as an overlay to the base icon, to the lower-right
        Parameters:
        icon - the icon
        Returns:
        this builder
      • addLowerRightIcon

        public MultiIconBuilder addLowerRightIcon​(javax.swing.Icon icon,
                                                  int w,
                                                  int h)
        Adds the given icon as an overlay to the base icon, to the lower-right, scaled to the given width and height
        Parameters:
        icon - the icon
        w - the desired width
        h - the desired height
        Returns:
        this builder
      • addLowerLeftIcon

        public MultiIconBuilder addLowerLeftIcon​(javax.swing.Icon icon)
        Adds the given icon as an overlay to the base icon, to the lower-left
        Parameters:
        icon - the icon
        Returns:
        this builder
      • addLowerLeftIcon

        public MultiIconBuilder addLowerLeftIcon​(javax.swing.Icon icon,
                                                 int w,
                                                 int h)
        Adds the given icon as an overlay to the base icon, to the lower-left, scaled to the given width and height
        Parameters:
        icon - the icon
        w - the desired width
        h - the desired height
        Returns:
        this builder
      • setDescription

        public MultiIconBuilder setDescription​(java.lang.String description)
        Sets a description for the icon being built. This is useful for debugging.
        Parameters:
        description - the description
        Returns:
        this builder
      • build

        public javax.swing.ImageIcon build()