|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.Observable
|
+--grad.BasicGradientPainter
BasicGradientPainter is an abstract base class that handles the management of GradientSegment management for other GradientPainter classes.
A gradient can be a simple gradient, defined by a start and end color, or it can be a multi-part gradient composed of several GradientSegment objects.
This class also extends Observable. Whenever the stored gradients vector changes, the observers will be notified.
GradientSegment,
GradientPainter,
LinearGradientPainter, Serialized Form| Field Summary | |
static int |
DEFAULT_MODE
The default painting mode -- 0. |
protected BasicGradientPainter |
master
|
protected java.util.Vector |
segments
|
| Constructor Summary | |
BasicGradientPainter()
Create a new BasicGradientPainter with 0 segments. |
|
BasicGradientPainter(BasicGradientPainter src)
Create a new BasicGradientPainter, initialized with a copy of the gradient segments of the supplied painter. |
|
| Method Summary | |
void |
addSegment(GradientSegment gs)
Append another GradientSegment to the sequence used by the painter. |
int |
countSegments()
Return the count of how many segments this painter is currently holding. |
void |
flipSegment(int i)
Flip the specified segment, exchange its start and end color values. |
GradientSegment |
getSegment(int i)
Get the GradientSegment no. |
void |
gradientsChanged()
Take any necessary action if the gradients have changed. |
abstract void |
paint(java.awt.Graphics g,
java.awt.Shape s,
int mode)
Paint a gradient into a given Shape using a given Graphics, using the given mode. |
GradientSegment |
removeSegment(int i)
Remove the GradientSegment no. |
void |
setSegment(int i,
GradientSegment gs)
Replace the GradientSegment no. |
void |
slaveTo(BasicGradientPainter m)
Share our gradient segment list with another gradient painter. |
void |
splitSegment(int i)
Split the specified GradientSegment no. |
boolean |
swapAt(int i)
Swap segments i and i-1, preserving the offset of the other segments. |
java.lang.String |
toCodeFragment(java.lang.String toPainter)
A representation of this GradientPainter as a code fragment creating a GradientPainter named toPainter. |
java.lang.String |
toString()
A simple representation of this GradientPainter as a string. |
void |
update(java.util.Observable o,
java.lang.Object x)
Observe our master if we have one. |
| Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_MODE
protected java.util.Vector segments
protected BasicGradientPainter master
| Constructor Detail |
public BasicGradientPainter()
public BasicGradientPainter(BasicGradientPainter src)
src - Painter whose segments are to be copied| Method Detail |
public void slaveTo(BasicGradientPainter m)
public void update(java.util.Observable o,
java.lang.Object x)
update in interface java.util.Observer
public abstract void paint(java.awt.Graphics g,
java.awt.Shape s,
int mode)
g - Graphics to paint intos - Shape to fill (usually a Rectangle)mode - Gradient generation mode (defined per subclass)public void gradientsChanged()
public void splitSegment(int i)
public void flipSegment(int i)
public boolean swapAt(int i)
public GradientSegment getSegment(int i)
public GradientSegment removeSegment(int i)
public void setSegment(int i,
GradientSegment gs)
public void addSegment(GradientSegment gs)
public int countSegments()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toCodeFragment(java.lang.String toPainter)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||