Package docking.util
Class BadgedIcon
java.lang.Object
docking.util.BadgedIcon
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionBadgedIcon
(Icon baseIcon) BadgedIcon
(Icon baseIcon, boolean enabled) BadgedIcon
(Icon baseIcon, boolean enabled, int width, int height) -
Method Summary
Modifier and TypeMethodDescriptionaddBadge
(Icon badge, BadgedIcon.BadgePosition position) Add an icon at the specified locationaddScaledBadge
(Icon icon, int newWidth, int newHeight, BadgedIcon.BadgePosition position) Icon[]
Return array of Icons that were added to this BadgedIcon.int
int
boolean
isBadgeEnabled
(BadgedIcon.BadgePosition position) Get the enablement status of the badge at the specified locationboolean
isBadgeVisible
(BadgedIcon.BadgePosition position) Get the visibility status of the badge at the specified locationboolean
Determine the overall enablement appearance state.void
removeBadge
(BadgedIcon.BadgePosition position) Remove the badge from the specified locationsetBadge
(Icon badge, BadgedIcon.BadgePosition position) Replace the existing icon with the provided icon at the specified locationvoid
setBadgeEnabled
(BadgedIcon.BadgePosition position, boolean enabled) Set the enablement of the badge at the specified locationvoid
setBadgeVisisble
(BadgedIcon.BadgePosition position, boolean visible) Set the visibility status of the badge at the specified locationvoid
setEnabled
(boolean enabled) Set the 'enabled' appearance of the entire icon.toString()
-
Constructor Details
-
BadgedIcon
-
BadgedIcon
-
BadgedIcon
-
-
Method Details
-
addBadge
Add an icon at the specified location- Parameters:
badge
- The iconposition
- 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
Replace the existing icon with the provided icon at the specified location- Parameters:
badge
- The iconposition
- Where to place the image- Returns:
- a reference to this object
-
removeBadge
Remove the badge from the specified location- Parameters:
position
- Where to place the image- Returns:
- a reference to this object
-
setBadgeEnabled
Set the enablement of the badge at the specified location- Parameters:
position
- Which icon to modifyenabled
- True if the image should be shown 'enabled', false otherwise- See Also:
-
isBadgeEnabled
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
Set the visibility status of the badge at the specified location- Parameters:
position
- Which icon to modifyvisible
- True if the badge should be visible, false otherwise- See Also:
-
isBadgeVisible
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 interfaceIcon
- See Also:
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidth
in interfaceIcon
- 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 ifsetEnabled(true)
is called.- Parameters:
enabled
-
-
getBadges
Return array of Icons that were added to this BadgedIcon. -
paintIcon
-
toString
-