Class GradientBackground
java.lang.Object
ch.swingfx.twinkle.style.background.GradientBackground
- All Implemented Interfaces:
IBackground
Paint a top to bottom gradient.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGradientBackground
(Color startColor, Color endColor) Create a gradient background -
Method Summary
Modifier and TypeMethodDescriptionvoid
paintBackground
(Graphics g, boolean isMouseOver, int cornerRadius) Paint the backgroundvoid
setAlpha
(float alpha) Set the alpha of this component.
-
Field Details
-
fStartColor
-
fEndColor
-
-
Constructor Details
-
GradientBackground
Create a gradient background- Parameters:
startColor
- color to use from topendColor
- color to use at the bottom
-
-
Method Details
-
paintBackground
Description copied from interface:IBackground
Paint the background- Specified by:
paintBackground
in interfaceIBackground
- Parameters:
g
- graphics to paint onisMouseOver
- true if the mouse if over the notificationcornerRadius
- corner radius of the window
-
setAlpha
public void setAlpha(float alpha) Description copied from interface:IBackground
Set the alpha of this component. Usual you don't call this method. Instead useNotificationBuilder
.withAlpha(float)
Note this only works if theGraphicsConfiguration
supports per-pixel translucency.- Specified by:
setAlpha
in interfaceIBackground
- Parameters:
alpha
- value between 0.0f (completely transparent) and 1.0f (opaque)
-