Package com.explodingpixels.painter
Class ButtonStatePainter<B extends javax.swing.AbstractButton>
- java.lang.Object
-
- com.explodingpixels.painter.ButtonStatePainter<B>
-
- All Implemented Interfaces:
MacWidgetsPainter<B>
public class ButtonStatePainter<B extends javax.swing.AbstractButton> extends java.lang.Object implements MacWidgetsPainter<B>
AMacWidgetsPainterthat 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", therolloverPainterwill be called; if the button is pressed, then thepressedPainterwill be called, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classButtonStatePainter.DummyPainterAn implementation ofMacWidgetsPainterthat does no painting.
-
Constructor Summary
Constructors Constructor Description ButtonStatePainter(MacWidgetsPainter<java.awt.Component> defaultPainter)Creates a painter that will always use the givenMacWidgetsPainterto paint the button.ButtonStatePainter(MacWidgetsPainter<java.awt.Component> defaultPainter, MacWidgetsPainter<java.awt.Component> rolloverPainter, MacWidgetsPainter<java.awt.Component> pressedPainter, MacWidgetsPainter<java.awt.Component> selectedPainter)Creates a painter that will delegate to the given painters based on the current state of the button.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpaint(java.awt.Graphics2D g, B button, int width, int height)Renders to the givenGraphics2D.
-
-
-
Constructor Detail
-
ButtonStatePainter
public ButtonStatePainter(MacWidgetsPainter<java.awt.Component> defaultPainter)
Creates a painter that will always use the givenMacWidgetsPainterto paint the button.- Parameters:
defaultPainter- thePainterto use to paint the button.
-
ButtonStatePainter
public ButtonStatePainter(MacWidgetsPainter<java.awt.Component> defaultPainter, MacWidgetsPainter<java.awt.Component> rolloverPainter, MacWidgetsPainter<java.awt.Component> pressedPainter, MacWidgetsPainter<java.awt.Component> selectedPainter)
Creates a painter that will delegate to the given painters based on the current state of the button.- Parameters:
defaultPainter- theMacWidgetsPainterto use when the button has no specific state.rolloverPainter- thePainterto use when the button is being "rolled over".pressedPainter- thePainterto use when the button is being pressed.selectedPainter- thePainterto use when the button has been selected.
-
-
Method Detail
-
paint
public void paint(java.awt.Graphics2D g, B button, int width, int height)Description copied from interface:MacWidgetsPainterRenders to the givenGraphics2D. The supplied graphics context may be modified - it's state need not be restored upon completion of painting.- Specified by:
paintin interfaceMacWidgetsPainter<B extends javax.swing.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.
-
-