Package smile.swing
Record Class AlphaIcon
java.lang.Object
java.lang.Record
smile.swing.AlphaIcon
- Record Components:
icon
- the Icon to wrapalpha
- the opacity should be in the range 0.0F (fully transparent) to 1.0F (fully opaque).
- All Implemented Interfaces:
Icon
An Icon wrapper that paints the contained icon with a specified transparency.
Note: This class is not suitable for wrapping an
ImageIcon
that holds an animated image.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
alpha()
Returns the value of thealpha
record component.final boolean
Indicates whether some other object is "equal to" this one.int
Gets the height of the bounding rectangle of thisAlphaIcon
.int
Gets the width of the bounding rectangle of thisAlphaIcon
.final int
hashCode()
Returns a hash code value for this object.icon()
Returns the value of theicon
record component.void
Paints the wrapped icon with thisAlphaIcon
's transparency.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
paintIcon
Paints the wrapped icon with thisAlphaIcon
's transparency. -
getIconWidth
public int getIconWidth()Gets the width of the bounding rectangle of thisAlphaIcon
. Returns the width of the wrapped icon.- Specified by:
getIconWidth
in interfaceIcon
- Returns:
- the width in pixels
-
getIconHeight
public int getIconHeight()Gets the height of the bounding rectangle of thisAlphaIcon
. * Returns the height of the wrapped icon.- Specified by:
getIconHeight
in interfaceIcon
- Returns:
- the height in pixels
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
icon
Returns the value of theicon
record component.- Returns:
- the value of the
icon
record component
-
alpha
public float alpha()Returns the value of thealpha
record component.- Returns:
- the value of the
alpha
record component
-