Class Appearance
java.lang.Object
de.gurkenlabs.litiengine.gui.Appearance
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Appearance with default settings.Appearance(Color foreColor) Constructs a new Appearance with the specified foreground color.Appearance(Color foreColor, Color backColor) Constructs a new Appearance with the specified foreground and background colors. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this Appearance object to the specified object for equality.protected voidTriggers the change event for all registered consumers.Gets the first background color.Gets the second background color.getBackgroundPaint(double width, double height) Gets the background paint for the specified dimensions.Gets the border color.floatGets the border radius.Gets the border style.Gets the foreground color.inthashCode()Returns a hash code value for this Appearance object.booleanChecks if the background gradient is horizontal.booleanChecks if the background is transparent.voidonChange(Consumer<Appearance> cons) Adds a consumer to be notified when the appearance changes.voidsetBackgroundColor1(Color backColor1) Sets the first background color and triggers a change event.voidsetBackgroundColor2(Color backColor2) Sets the second background color and triggers a change event.voidsetBorderColor(Color color) Sets the border color.voidsetBorderRadius(float radius) Sets the border radius.voidsetBorderStyle(Stroke style) Sets the border style.voidsetForeColor(Color foreColor) Sets the foreground color and triggers a change event.voidsetHorizontalBackgroundGradient(boolean horizontal) Sets whether the background gradient is horizontal and triggers a change event.voidsetTransparentBackground(boolean transparentBackground) Sets whether the background is transparent and triggers a change event.voidupdate(Appearance updateAppearance) Updates the appearance settings with the values from the specified Appearance object.
-
Constructor Details
-
Appearance
public Appearance()Constructs a new Appearance with default settings. -
Appearance
Constructs a new Appearance with the specified foreground color.- Parameters:
foreColor- the foreground color
-
Appearance
-
-
Method Details
-
equals
-
hashCode
-
getForeColor
-
getBackgroundColor1
Gets the first background color.- Returns:
- the first background color
-
getBackgroundColor2
Gets the second background color.- Returns:
- the second background color
-
getBackgroundPaint
Gets the background paint for the specified dimensions.- Parameters:
width- the width of the componentheight- the height of the component- Returns:
- the background paint, or null if the background is transparent
-
getBorderColor
-
getBorderStyle
-
getBorderRadius
public float getBorderRadius()Gets the border radius.- Returns:
- the border radius
-
isHorizontalBackgroundGradient
public boolean isHorizontalBackgroundGradient()Checks if the background gradient is horizontal.- Returns:
- true if the background gradient is horizontal, false otherwise
-
isTransparentBackground
public boolean isTransparentBackground()Checks if the background is transparent.- Returns:
- true if the background is transparent, false otherwise
-
setForeColor
Sets the foreground color and triggers a change event.- Parameters:
foreColor- the new foreground color
-
setBackgroundColor1
Sets the first background color and triggers a change event.- Parameters:
backColor1- the new first background color
-
setBackgroundColor2
Sets the second background color and triggers a change event.- Parameters:
backColor2- the new second background color
-
setBorderColor
Sets the border color.- Parameters:
color- the new border color
-
setBorderStyle
Sets the border style.- Parameters:
style- the new border style
-
setBorderRadius
public void setBorderRadius(float radius) Sets the border radius.- Parameters:
radius- the new border radius
-
setHorizontalBackgroundGradient
public void setHorizontalBackgroundGradient(boolean horizontal) Sets whether the background gradient is horizontal and triggers a change event.- Parameters:
horizontal- true if the background gradient is horizontal, false otherwise
-
setTransparentBackground
public void setTransparentBackground(boolean transparentBackground) Sets whether the background is transparent and triggers a change event.- Parameters:
transparentBackground- true if the background is transparent, false otherwise
-
onChange
Adds a consumer to be notified when the appearance changes.- Parameters:
cons- the consumer to be added
-
update
Updates the appearance settings with the values from the specified Appearance object.- Parameters:
updateAppearance- the Appearance object containing the new settings
-
fireOnChangeEvent
protected void fireOnChangeEvent()Triggers the change event for all registered consumers.
-