org.jdesktop.swingx.painter.effects
Class NeonBorderEffect

java.lang.Object
  extended by org.jdesktop.swingx.painter.effects.AbstractAreaEffect
      extended by org.jdesktop.swingx.painter.effects.NeonBorderEffect
All Implemented Interfaces:
AreaEffect

public class NeonBorderEffect
extends AbstractAreaEffect

An effect which draws a multicolored border around a painter's shape. It will interpolate between two specified colors, creating a neon like effect.


Nested Class Summary
static class NeonBorderEffect.BorderPosition
          An enum representing the position of the border: inside, outside, or centered on the border.
 
Constructor Summary
NeonBorderEffect()
          Create a new NeonBorderEffect
NeonBorderEffect(Color edgeColor, Color centerColor, int effectWidth)
          Creates a new instance of NeonBorderEffect
 
Method Summary
 NeonBorderEffect.BorderPosition getBorderPosition()
           
 Color getCenterColor()
           
 Color getEdgeColor()
          Gets the current edge color.
protected  Color interpolateColor(float t, Color start, Color end)
           
protected  void paintBorderGlow(Graphics2D gfx, Shape clipShape, int width, int height)
          Paints the border glow
 void setBorderPosition(NeonBorderEffect.BorderPosition borderPosition)
           
 void setCenterColor(Color centerColor)
           
 void setEdgeColor(Color edgeColor)
          Set the edge color
 
Methods inherited from class org.jdesktop.swingx.painter.effects.AbstractAreaEffect
addPropertyChangeListener, apply, getBrushColor, getBrushSteps, getEffectWidth, getOffset, isRenderInsideShape, isShapeMasked, isShouldFillShape, removePropertyChangeListener, setBrushColor, setBrushSteps, setEffectWidth, setOffset, setRenderInsideShape, setShapeMasked, setShouldFillShape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeonBorderEffect

public NeonBorderEffect()
Create a new NeonBorderEffect


NeonBorderEffect

public NeonBorderEffect(Color edgeColor,
                        Color centerColor,
                        int effectWidth)
Creates a new instance of NeonBorderEffect

Method Detail

paintBorderGlow

protected void paintBorderGlow(Graphics2D gfx,
                               Shape clipShape,
                               int width,
                               int height)
Description copied from class: AbstractAreaEffect
Paints the border glow

Overrides:
paintBorderGlow in class AbstractAreaEffect

interpolateColor

protected Color interpolateColor(float t,
                                 Color start,
                                 Color end)

getEdgeColor

public Color getEdgeColor()
Gets the current edge color.

Returns:
current edge color

setEdgeColor

public void setEdgeColor(Color edgeColor)
Set the edge color

Parameters:
edgeColor -

getCenterColor

public Color getCenterColor()
Returns:
color in the center of the effect

setCenterColor

public void setCenterColor(Color centerColor)
Parameters:
centerColor - color in the center of the effect.
See Also:
getCenterColor()

getBorderPosition

public NeonBorderEffect.BorderPosition getBorderPosition()
Returns:
position of the border relative to the edge of painter covered area.
See Also:
NeonBorderEffect.BorderPosition

setBorderPosition

public void setBorderPosition(NeonBorderEffect.BorderPosition borderPosition)
Parameters:
borderPosition - position of the border relative to the edge of painter covered area.
See Also:
getBorderPosition(), NeonBorderEffect.BorderPosition