JIDE 3.5.15

com.jidesoft.gauge
Class DialRadialPaint

java.lang.Object
  extended by com.jidesoft.gauge.DialRadialPaint
All Implemented Interfaces:
Paint, Transparency

public class DialRadialPaint
extends Object
implements Paint

A Paint class where you can easily configure a radial paint that emanates from the pivot point of a dial.


Field Summary
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
DialRadialPaint(Dial dial, float[] fractions, Color[] colors)
          Constructs a Radial gradient paint centred on the pivot point of the dial.
DialRadialPaint(Dial dial, float[] fractions, Color[] colors, float offsetRadius, float offsetAngle)
          This constructor allows you to specify fractions and colors as for the other constructor, but also allows you to specify an offset for the centre of the radial paint.
 
Method Summary
 PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints)
           
 float getRadiusProportion()
           
 int getTransparency()
           
 void setRadiusProportion(Float radiusProportion)
          By default the radius of a DialRadialPaint is defined by the radius of the dial itself, but this becomes limiting if you want to use it for the paint of a DialFrame surrounding the dial, especially as the fractions supplied need to be in the range 0.0 to 1.0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialRadialPaint

public DialRadialPaint(Dial dial,
                       float[] fractions,
                       Color[] colors)
Constructs a Radial gradient paint centred on the pivot point of the dial.

Parameters:
dial - the dial from which the paint derives its centre point
fractions - fractions for specifying the color mix
colors - the colors to use at the points indicated by fractions

DialRadialPaint

public DialRadialPaint(Dial dial,
                       float[] fractions,
                       Color[] colors,
                       float offsetRadius,
                       float offsetAngle)
This constructor allows you to specify fractions and colors as for the other constructor, but also allows you to specify an offset for the centre of the radial paint. This could be useful for example if you wanted to use an offset to give the impression of light being projected from a particular direction. The offset is expressed in terms of the radius of the dial and an angle, so the paint will be scalable should the component's size be changed.

Parameters:
dial - the dial to which the paint will be applied
fractions - the fraction points corresponding to the colors
colors - the colors of the radial paint
offsetRadius - the radius of the offset, specified as a proportion of the pixel radius
offsetAngle - the angle of the offset, specified in degrees.
Method Detail

getRadiusProportion

public float getRadiusProportion()

setRadiusProportion

public void setRadiusProportion(Float radiusProportion)
By default the radius of a DialRadialPaint is defined by the radius of the dial itself, but this becomes limiting if you want to use it for the paint of a DialFrame surrounding the dial, especially as the fractions supplied need to be in the range 0.0 to 1.0. Using this method you can modify the radius used for the Paint by a multiplying factor, allowing you to use this paint class for filling a DialFrame.

Parameters:
radiusProportion - a multiplying factor to apply to the radius of the dial

createContext

public PaintContext createContext(ColorModel cm,
                                  Rectangle deviceBounds,
                                  Rectangle2D userBounds,
                                  AffineTransform transform,
                                  RenderingHints hints)
Specified by:
createContext in interface Paint

getTransparency

public int getTransparency()
Specified by:
getTransparency in interface Transparency

JIDE 3.5.15