Package com.iizix.prop
Class GBadge
java.lang.Object
com.iizix.prop.GBadge
- All Implemented Interfaces:
- Cloneable
A badge holds a short text with a color and font size. Longer texts can be applied and will be shown with trailing ellipsis and will show a tooltip when the component is focused. This is typically used for error or warning messages.
The class immutable and its clone is therefore itself.
- Author:
- Christopher Mindus
- Nested Class SummaryNested ClassesModifier and TypeClassDescription- static enumSpecifies the color of the badge.- static enumThe location of the badge relative the component.
- Field SummaryFieldsModifier and TypeFieldDescription- final GBadge.ColorThe color.- static final intThe default font size (16 px).- final intThe font size in pixels (6-255), zero for default 16.- final GBadge.LocationThe location.- final KStringThe KString holding the text.
- Constructor SummaryConstructorsConstructorDescriptionCreates a new red badge with default font size (16 pixels).Creates a new badge with a text and the settings from an old badge.- GBadge- (KString text, GBadge.Color color) Creates a new badge with default font size.- GBadge- (KString text, GBadge.Color color, GBadge.Location location) Creates a new badge with default font size (16 pixels).- GBadge- (KString text, GBadge.Color color, GBadge.Location location, int fontSize) Creates a new badge.- GBadge- (KString text, GBadge.Location location) Creates a new red badge with default font size (16 pixels).Creates a new red badge with default font size (16 pixels).
- Method SummaryModifier and TypeMethodDescription- clone()Clones the badge.- void- dispose()Disposes of the badge when no longer needed.- booleanChecks if two badge objects are equal.- booleanChecks for pure equality between two GBadge's, excluding reference refresh counter checking but including potential original source string.- protected void- finalize()Called when the badge is being garbage collected.- int- hashCode()Hash code.- toString()Returns a string representation of this class instance and its values.
- Field Details- DEFAULT_FONT_SIZEpublic static final int DEFAULT_FONT_SIZEThe default font size (16 px).- See Also:
 
- textThe KString holding the text.
- colorThe color.
- locationThe location.
- fontSizepublic final int fontSizeThe font size in pixels (6-255), zero for default 16.
 
- Constructor Details- GBadgeCreates a new red badge with default font size (16 pixels). The location is top-trailing.- Parameters:
- text- The plain text string, i.e. not in HTML.
- Throws:
- NullPointerException- If text is null.
 
- GBadgeCreates a new red badge with default font size (16 pixels). The location is top-trailing.- Parameters:
- text- The text.
- Throws:
- NullPointerException- If text is null.
 
- GBadgeCreates a new badge with default font size. The location is top-trailing.- Parameters:
- text- The text.
- color- The color, null for default red.
- Throws:
- NullPointerException- If text is null.
 
- GBadgeCreates a new red badge with default font size (16 pixels).- Parameters:
- text- The text.
- location- The location, null for default top-trailing.
- Throws:
- NullPointerException- If text is null.
 
- GBadgeCreates a new badge with default font size (16 pixels).- Parameters:
- text- The text.
- color- The color, null for default red.
- location- The location, null for default top-trailing.
- Throws:
- NullPointerException- If text is null.
 
- GBadgeCreates a new badge with a text and the settings from an old badge.- Parameters:
- text- The text.
- badge- The badge to use all settings from, exception the text.
- Throws:
- NullPointerException- If text is null.
 
- GBadgeCreates a new badge.- Parameters:
- text- The text.
- color- The color, null for default red.
- location- The location, null for default top-trailing.
- fontSize- The font size between 6 to 255 pixels, 0 for default (16).
- Throws:
- NullPointerException- If text is null.
- IllegalArgumentException- If fontSize is not 6 to 255 pixels.
 
 
- Method Details- cloneClones the badge.
- disposepublic void dispose()Disposes of the badge when no longer needed. This method is required for KString text.
- finalizeCalled when the badge is being garbage collected.- The KString will be disposed if not previously disposed of. 
- equalsChecks if two badge objects are equal.
- hashCodepublic int hashCode()Hash code.
- equalsOmitReferenceRefreshCheckChecks for pure equality between two GBadge's, excluding reference refresh counter checking but including potential original source string.- This method is used when comparing values for e.g. save file. - Parameters:
- badge- Another GBadge, perhaps null.
- Returns:
- true if equal, false otherwise.
 
- toStringReturns a string representation of this class instance and its values.