Package com.explodingpixels.painter
Class ButtonStatePainter<B extends AbstractButton>
java.lang.Object
com.explodingpixels.painter.ButtonStatePainter<B>
- All Implemented Interfaces:
MacWidgetsPainter<B>
public class ButtonStatePainter<B extends AbstractButton>
extends Object
implements MacWidgetsPainter<B>
A
MacWidgetsPainter
that can be used to paint the various states of a button. This painter
will delegate to the supplied painters based on the current state of the button. That is, if the button is being
"rolled over", the rolloverPainter
will be called; if the button is pressed, then the pressedPainter
will be called, etc.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An implementation ofMacWidgetsPainter
that does no painting. -
Constructor Summary
ConstructorsConstructorDescriptionButtonStatePainter
(MacWidgetsPainter<Component> defaultPainter) Creates a painter that will always use the givenMacWidgetsPainter
to paint the button.ButtonStatePainter
(MacWidgetsPainter<Component> defaultPainter, MacWidgetsPainter<Component> rolloverPainter, MacWidgetsPainter<Component> pressedPainter, MacWidgetsPainter<Component> selectedPainter) Creates a painter that will delegate to the given painters based on the current state of the button. -
Method Summary
Modifier and TypeMethodDescriptionvoid
paint
(Graphics2D g, B button, int width, int height) Renders to the givenGraphics2D
.
-
Constructor Details
-
ButtonStatePainter
Creates a painter that will always use the givenMacWidgetsPainter
to paint the button.- Parameters:
defaultPainter
- thePainter
to use to paint the button.
-
ButtonStatePainter
public ButtonStatePainter(MacWidgetsPainter<Component> defaultPainter, MacWidgetsPainter<Component> rolloverPainter, MacWidgetsPainter<Component> pressedPainter, MacWidgetsPainter<Component> selectedPainter) Creates a painter that will delegate to the given painters based on the current state of the button.- Parameters:
defaultPainter
- theMacWidgetsPainter
to use when the button has no specific state.rolloverPainter
- thePainter
to use when the button is being "rolled over".pressedPainter
- thePainter
to use when the button is being pressed.selectedPainter
- thePainter
to use when the button has been selected.
-
-
Method Details
-
paint
Description copied from interface:MacWidgetsPainter
Renders to the givenGraphics2D
. The supplied graphics context may be modified - it's state need not be restored upon completion of painting.- Specified by:
paint
in interfaceMacWidgetsPainter<B extends AbstractButton>
- Parameters:
g
- the graphics context to paint into. It's state need not be restored. Will not be null.button
- the object to be painted.width
- the width within the object to paint.height
- the height within the object to paint.
-