com.explodingpixels.painter
Class FocusStatePainter

java.lang.Object
  extended by com.explodingpixels.painter.FocusStatePainter
All Implemented Interfaces:
Painter<Component>

public class FocusStatePainter
extends Object
implements Painter<Component>

An implementation of Painter that delegates to given Painter based on the focused state of the Component supplied in the paint(java.awt.Graphics2D, java.awt.Component, int, int) method.


Constructor Summary
FocusStatePainter(Painter<Component> componentFocusedPainter, Painter<Component> windowUnfocusedPainter)
          Creates a Painter that delegates to the given Painters based on the focus state of the supplied Component or the focus state of it's parent Window.
FocusStatePainter(Painter<Component> componentFocusedPainter, Painter<Component> windowFocusedPainter, Painter<Component> windowUnfocusedPainter)
          Creates a Painter that delegates to the given Painters based on the focus state of the supplied Component or the focus state of it's parent Window.
 
Method Summary
 void paint(Graphics2D g, Component component, int width, int height)
          Renders to the given Graphics2D.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FocusStatePainter

public FocusStatePainter(Painter<Component> componentFocusedPainter,
                         Painter<Component> windowUnfocusedPainter)
Creates a Painter that delegates to the given Painters based on the focus state of the supplied Component or the focus state of it's parent Window.

Parameters:
componentFocusedPainter - the Painter to use when the given Component is focused or it's parent java.awt.Window is focused.
windowUnfocusedPainter - the Painter to use when the given Component's parent java.awt.Window is unfocused.

FocusStatePainter

public FocusStatePainter(Painter<Component> componentFocusedPainter,
                         Painter<Component> windowFocusedPainter,
                         Painter<Component> windowUnfocusedPainter)
Creates a Painter that delegates to the given Painters based on the focus state of the supplied Component or the focus state of it's parent Window.

Parameters:
componentFocusedPainter - the Painter to use when the given Component is focused.
windowFocusedPainter - the Painter to use when the given Component is unfocused but the Component's parent window is focused.
windowUnfocusedPainter - the Painter to use when the given Component's parent java.awt.Window is unfocused.
Method Detail

paint

public void paint(Graphics2D g,
                  Component component,
                  int width,
                  int height)
Description copied from interface: Painter
Renders to the given Graphics2D. The supplied graphics context may be modified - it's state need not be restored upon completion of painting.

Specified by:
paint in interface Painter<Component>
Parameters:
g - the graphics context to paint into. It's state need not be restored. Will not be null.
component - the object to be painted.
width - the width within the object to paint.
height - the height within the object to paint.