Package docking.util

Class BadgedIcon

java.lang.Object
docking.util.BadgedIcon
All Implemented Interfaces:
Icon

public class BadgedIcon extends Object implements Icon
An icon that allows sub-icons to be added at key perimeter locations. Each position can be manipulated independently, adding and removing icons as desired. Additionally, each position can be toggled enabled or disabled, or visible or invisible.
  • Constructor Details

    • BadgedIcon

      public BadgedIcon(Icon baseIcon)
    • BadgedIcon

      public BadgedIcon(Icon baseIcon, boolean enabled)
    • BadgedIcon

      public BadgedIcon(Icon baseIcon, boolean enabled, int width, int height)
  • Method Details

    • addBadge

      public BadgedIcon addBadge(Icon badge, BadgedIcon.BadgePosition position)
      Add an icon at the specified location
      Parameters:
      badge - The icon
      position - Where to place the image
      Returns:
      a reference to this object
    • addScaledBadge

      public BadgedIcon addScaledBadge(Icon icon, int newWidth, int newHeight, BadgedIcon.BadgePosition position)
    • setBadge

      public BadgedIcon setBadge(Icon badge, BadgedIcon.BadgePosition position)
      Replace the existing icon with the provided icon at the specified location
      Parameters:
      badge - The icon
      position - Where to place the image
      Returns:
      a reference to this object
    • removeBadge

      public BadgedIcon removeBadge(BadgedIcon.BadgePosition position)
      Remove the badge from the specified location
      Parameters:
      position - Where to place the image
      Returns:
      a reference to this object
    • setBadgeEnabled

      public void setBadgeEnabled(BadgedIcon.BadgePosition position, boolean enabled)
      Set the enablement of the badge at the specified location
      Parameters:
      position - Which icon to modify
      enabled - True if the image should be shown 'enabled', false otherwise
      See Also:
    • isBadgeEnabled

      public boolean isBadgeEnabled(BadgedIcon.BadgePosition position)
      Get the enablement status of the badge at the specified location
      Parameters:
      position - Which icon to enquire about
      Returns:
      True if the badge is enabled, false otherwise
      See Also:
    • setBadgeVisisble

      public void setBadgeVisisble(BadgedIcon.BadgePosition position, boolean visible)
      Set the visibility status of the badge at the specified location
      Parameters:
      position - Which icon to modify
      visible - True if the badge should be visible, false otherwise
      See Also:
    • isBadgeVisible

      public boolean isBadgeVisible(BadgedIcon.BadgePosition position)
      Get the visibility status of the badge at the specified location
      Parameters:
      position - Which icon to enquire about
      Returns:
      True if the badge is visible, false otherwise
      See Also:
    • getIconHeight

      public int getIconHeight()
      Specified by:
      getIconHeight in interface Icon
      See Also:
    • getIconWidth

      public int getIconWidth()
      Specified by:
      getIconWidth in interface Icon
      See Also:
    • isEnabled

      public boolean isEnabled()
      Determine the overall enablement appearance state.
      Returns:
      true if the if the entire icon is rendered as 'enabled'; false otherwise.
    • setEnabled

      public void setEnabled(boolean enabled)
      Set the 'enabled' appearance of the entire icon. Preserves the underlying enablement state of badges, though the entire icon looks disabled if setEnabled(true) is called.
      Parameters:
      enabled -
    • getBadges

      public Icon[] getBadges(BadgedIcon.BadgePosition pos)
      Return array of Icons that were added to this BadgedIcon.
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Specified by:
      paintIcon in interface Icon
    • toString

      public String toString()
      Overrides:
      toString in class Object