org.jvnet.substance.api.painter.border
Class FractionBasedBorderPainter

java.lang.Object
  extended by org.jvnet.substance.api.painter.FractionBasedPainter
      extended by org.jvnet.substance.api.painter.border.FractionBasedBorderPainter
All Implemented Interfaces:
SubstanceTrait, SubstanceBorderPainter

public class FractionBasedBorderPainter
extends FractionBasedPainter
implements SubstanceBorderPainter

Border painter with fraction-based stops and a color query associated with each stop. This class allows creating multi-gradient borders with exact control over which color is used at every gradient control point.

Author:
Kirill Grouchnikov

Field Summary
 
Fields inherited from class org.jvnet.substance.api.painter.FractionBasedPainter
colorQueries, fractions
 
Constructor Summary
FractionBasedBorderPainter(java.lang.String displayName, float[] fractions, ColorSchemeSingleColorQuery[] colorQueries)
          Creates a new fraction-based border painter.
 
Method Summary
 boolean isPaintingInnerContour()
          Returns boolean indication whether this border painter is painting the inner contours.
 void paintBorder(java.awt.Graphics g, java.awt.Component c, int width, int height, java.awt.Shape contour, java.awt.Shape innerContour, SubstanceColorScheme colorScheme1, SubstanceColorScheme colorScheme2, float cyclePos, boolean useCyclePosAsInterpolation)
          Paints the control border.
 
Methods inherited from class org.jvnet.substance.api.painter.FractionBasedPainter
getColorQueries, getDisplayName, getFractions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jvnet.substance.api.trait.SubstanceTrait
getDisplayName
 

Constructor Detail

FractionBasedBorderPainter

public FractionBasedBorderPainter(java.lang.String displayName,
                                  float[] fractions,
                                  ColorSchemeSingleColorQuery[] colorQueries)
Creates a new fraction-based border painter.

Parameters:
displayName - The display name of this painter.
fractions - The fractions of this painter. Must be strictly increasing, starting from 0.0 and ending at 1.0.
colorQueries - The color queries of this painter. Must have the same size as the fractions array, and all entries must be non- null.
Method Detail

paintBorder

public void paintBorder(java.awt.Graphics g,
                        java.awt.Component c,
                        int width,
                        int height,
                        java.awt.Shape contour,
                        java.awt.Shape innerContour,
                        SubstanceColorScheme colorScheme1,
                        SubstanceColorScheme colorScheme2,
                        float cyclePos,
                        boolean useCyclePosAsInterpolation)
Description copied from interface: SubstanceBorderPainter
Paints the control border.

Specified by:
paintBorder in interface SubstanceBorderPainter
Parameters:
g - Graphics.
c - Component.
width - Width of a UI component.
height - Height of a UI component.
contour - Contour of a UI component.
innerContour - Inner contour of a UI component. May be ignored if the specific implementation paints only the outside border.
colorScheme1 - The first color scheme.
colorScheme2 - The second color scheme.
cyclePos - Cycle position. Is used for rollover and pulsation effects. Must be in 0..1 range.
useCyclePosAsInterpolation - Indicates the algorithm to use for computing various colors. If true, the cyclePos is used to interpolate colors between different color components of both color schemes. If false, the cyclePos is used to interpolate colors between different color components of the first color scheme.

isPaintingInnerContour

public boolean isPaintingInnerContour()
Description copied from interface: SubstanceBorderPainter
Returns boolean indication whether this border painter is painting the inner contours.

Specified by:
isPaintingInnerContour in interface SubstanceBorderPainter
Returns:
true if this border painter is painting the inner contours, false otherwise.