Package limn.backend.spi
Record Class TrayPicture
java.lang.Object
java.lang.Record
limn.backend.spi.TrayPicture
- Record Components:
icon- the application's iconbadge- the dot's colour, ornullfor no dotbadgeAtLeft- whether the dot is at the top left corner and not the top rightframe- the frame of an animated icon to draw, from 0; 0 for a still one
public record TrayPicture(Icon icon, @Nullable Color badge, boolean badgeAtLeft, int frame)
extends Record
A tray icon's picture at whatever size a system asks for: the application's icon, and the dot
that says attention when it has one.
Two pictures are equal when they would draw the same thing, so a backend can tell a state that changed its picture from one that did not. An animated icon is played by the tray, which hands the peer a state for each frame as it falls due: a picture of the frame that changed is not equal to the one before, and is shown as any new picture is.
-
Constructor Summary
ConstructorsConstructorDescriptionTrayPicture(Icon icon, @Nullable Color badge, boolean badgeAtLeft, int frame) Checks the icon and the frame. -
Method Summary
Modifier and TypeMethodDescription@Nullable Colorbadge()Returns the value of thebadgerecord component.booleanReturns the value of thebadgeAtLeftrecord component.final booleanIndicates whether some other object is "equal to" this one.intframe()Returns the value of theframerecord component.final inthashCode()Returns a hash code value for this object.icon()Returns the value of theiconrecord component.Draws the picture into a square ofpixelSize: the icon'sframefitted and centred, intintwhen it is one that takes a colour and a tint is given, and the dot over it, which every frame carries.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TrayPicture
Checks the icon and the frame.- Throws:
IndexOutOfBoundsException- when the icon has no such frame
-
-
Method Details
-
render
Draws the picture into a square ofpixelSize: the icon'sframefitted and centred, intintwhen it is one that takes a colour and a tint is given, and the dot over it, which every frame carries.- Parameters:
pixelSize- the square's side in device pixels, at least 1tint- the colour of a tintable icon, ornullto leave it as it isdark- whether the surface behind is dark, for an icon with a light and a dark form- Returns:
- the picture, straight alpha
-
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 theiconrecord component.- Returns:
- the value of the
iconrecord component
-
badge
Returns the value of thebadgerecord component.- Returns:
- the value of the
badgerecord component
-
badgeAtLeft
public boolean badgeAtLeft()Returns the value of thebadgeAtLeftrecord component.- Returns:
- the value of the
badgeAtLeftrecord component
-
frame
public int frame()Returns the value of theframerecord component.- Returns:
- the value of the
framerecord component
-