org.jfree.chart.plot

Class Marker

public abstract class Marker extends Object implements Cloneable, Serializable

The base class for markers that can be added to plots to highlight a value or range of values.

An event notification mechanism was added to this class in JFreeChart version 1.0.3.
Constructor Summary
protected Marker()
Creates a new marker with default attributes.
protected Marker(Paint paint)
Constructs a new marker.
protected Marker(Paint paint, Stroke stroke, Paint outlinePaint, Stroke outlineStroke, float alpha)
Constructs a new marker.
Method Summary
voidaddChangeListener(MarkerChangeListener listener)
Registers an object for notification of changes to the marker.
Objectclone()
Creates a clone of the marker.
booleanequals(Object obj)
Tests the marker for equality with an arbitrary object.
floatgetAlpha()
Returns the alpha transparency.
StringgetLabel()
Returns the label (if null no label is displayed).
RectangleAnchorgetLabelAnchor()
Returns the label anchor.
FontgetLabelFont()
Returns the label font.
RectangleInsetsgetLabelOffset()
Returns the label offset.
LengthAdjustmentTypegetLabelOffsetType()
Returns the label offset type.
PaintgetLabelPaint()
Returns the label paint.
TextAnchorgetLabelTextAnchor()
Returns the label text anchor.
EventListener[]getListeners(Class listenerType)
Returns an array containing all the listeners of the specified type.
PaintgetOutlinePaint()
Returns the outline paint.
StrokegetOutlineStroke()
Returns the outline stroke.
PaintgetPaint()
Returns the paint.
StrokegetStroke()
Returns the stroke.
voidnotifyListeners(MarkerChangeEvent event)
Notifies all registered listeners that the marker has been modified.
voidremoveChangeListener(MarkerChangeListener listener)
Unregisters an object for notification of changes to the marker.
voidsetAlpha(float alpha)
Sets the alpha transparency that should be used when drawing the marker, and sends a MarkerChangeEvent to all registered listeners.
voidsetLabel(String label)
Sets the label (if null no label is displayed) and sends a MarkerChangeEvent to all registered listeners.
voidsetLabelAnchor(RectangleAnchor anchor)
Sets the label anchor and sends a MarkerChangeEvent to all registered listeners.
voidsetLabelFont(Font font)
Sets the label font and sends a MarkerChangeEvent to all registered listeners.
voidsetLabelOffset(RectangleInsets offset)
Sets the label offset and sends a MarkerChangeEvent to all registered listeners.
voidsetLabelOffsetType(LengthAdjustmentType adj)
Sets the label offset type and sends a MarkerChangeEvent to all registered listeners.
voidsetLabelPaint(Paint paint)
Sets the label paint and sends a MarkerChangeEvent to all registered listeners.
voidsetLabelTextAnchor(TextAnchor anchor)
Sets the label text anchor and sends a MarkerChangeEvent to all registered listeners.
voidsetOutlinePaint(Paint paint)
Sets the outline paint and sends a MarkerChangeEvent to all registered listeners.
voidsetOutlineStroke(Stroke stroke)
Sets the outline stroke and sends a MarkerChangeEvent to all registered listeners.
voidsetPaint(Paint paint)
Sets the paint and sends a MarkerChangeEvent to all registered listeners.
voidsetStroke(Stroke stroke)
Sets the stroke and sends a MarkerChangeEvent to all registered listeners.

Constructor Detail

Marker

protected Marker()
Creates a new marker with default attributes.

Marker

protected Marker(Paint paint)
Constructs a new marker.

Parameters: paint the paint (null not permitted).

Marker

protected Marker(Paint paint, Stroke stroke, Paint outlinePaint, Stroke outlineStroke, float alpha)
Constructs a new marker.

Parameters: paint the paint (null not permitted). stroke the stroke (null not permitted). outlinePaint the outline paint (null permitted). outlineStroke the outline stroke (null permitted). alpha the alpha transparency (must be in the range 0.0f to 1.0f).

Throws: IllegalArgumentException if paint or stroke is null, or alpha is not in the specified range.

Method Detail

addChangeListener

public void addChangeListener(MarkerChangeListener listener)
Registers an object for notification of changes to the marker.

Parameters: listener the object to be registered.

Since: 1.0.3

See Also:

clone

public Object clone()
Creates a clone of the marker.

Returns: A clone.

Throws: CloneNotSupportedException never.

equals

public boolean equals(Object obj)
Tests the marker for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getAlpha

public float getAlpha()
Returns the alpha transparency.

Returns: The alpha transparency.

See Also: Marker

getLabel

public String getLabel()
Returns the label (if null no label is displayed).

Returns: The label (possibly null).

See Also: setLabel

getLabelAnchor

public RectangleAnchor getLabelAnchor()
Returns the label anchor. This defines the position of the label anchor, relative to the bounds of the marker.

Returns: The label anchor (never null).

See Also: setLabelAnchor

getLabelFont

public Font getLabelFont()
Returns the label font.

Returns: The label font (never null).

See Also: setLabelFont

getLabelOffset

public RectangleInsets getLabelOffset()
Returns the label offset.

Returns: The label offset (never null).

See Also: setLabelOffset

getLabelOffsetType

public LengthAdjustmentType getLabelOffsetType()
Returns the label offset type.

Returns: The type (never null).

See Also: setLabelOffsetType

getLabelPaint

public Paint getLabelPaint()
Returns the label paint.

Returns: The label paint (never null).

See Also: setLabelPaint

getLabelTextAnchor

public TextAnchor getLabelTextAnchor()
Returns the label text anchor.

Returns: The label text anchor (never null).

See Also: setLabelTextAnchor

getListeners

public EventListener[] getListeners(Class listenerType)
Returns an array containing all the listeners of the specified type.

Parameters: listenerType the listener type.

Returns: The array of listeners.

Since: 1.0.3

getOutlinePaint

public Paint getOutlinePaint()
Returns the outline paint.

Returns: The outline paint (possibly null).

See Also: setOutlinePaint

getOutlineStroke

public Stroke getOutlineStroke()
Returns the outline stroke.

Returns: The outline stroke (possibly null).

See Also: setOutlineStroke

getPaint

public Paint getPaint()
Returns the paint.

Returns: The paint (never null).

See Also: setPaint

getStroke

public Stroke getStroke()
Returns the stroke.

Returns: The stroke (never null).

See Also: setStroke

notifyListeners

public void notifyListeners(MarkerChangeEvent event)
Notifies all registered listeners that the marker has been modified.

Parameters: event information about the change event.

Since: 1.0.3

removeChangeListener

public void removeChangeListener(MarkerChangeListener listener)
Unregisters an object for notification of changes to the marker.

Parameters: listener the object to be unregistered.

Since: 1.0.3

See Also:

setAlpha

public void setAlpha(float alpha)
Sets the alpha transparency that should be used when drawing the marker, and sends a MarkerChangeEvent to all registered listeners. The alpha transparency is a value in the range 0.0f (completely transparent) to 1.0f (completely opaque).

Parameters: alpha the alpha transparency (must be in the range 0.0f to 1.0f).

Throws: IllegalArgumentException if alpha is not in the specified range.

See Also: getAlpha

setLabel

public void setLabel(String label)
Sets the label (if null no label is displayed) and sends a MarkerChangeEvent to all registered listeners.

Parameters: label the label (null permitted).

See Also: getLabel

setLabelAnchor

public void setLabelAnchor(RectangleAnchor anchor)
Sets the label anchor and sends a MarkerChangeEvent to all registered listeners. The anchor defines the position of the label anchor, relative to the bounds of the marker.

Parameters: anchor the anchor (null not permitted).

See Also: getLabelAnchor

setLabelFont

public void setLabelFont(Font font)
Sets the label font and sends a MarkerChangeEvent to all registered listeners.

Parameters: font the font (null not permitted).

See Also: getLabelFont

setLabelOffset

public void setLabelOffset(RectangleInsets offset)
Sets the label offset and sends a MarkerChangeEvent to all registered listeners.

Parameters: offset the label offset (null not permitted).

See Also: getLabelOffset

setLabelOffsetType

public void setLabelOffsetType(LengthAdjustmentType adj)
Sets the label offset type and sends a MarkerChangeEvent to all registered listeners.

Parameters: adj the type (null not permitted).

See Also: getLabelOffsetType

setLabelPaint

public void setLabelPaint(Paint paint)
Sets the label paint and sends a MarkerChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getLabelPaint

setLabelTextAnchor

public void setLabelTextAnchor(TextAnchor anchor)
Sets the label text anchor and sends a MarkerChangeEvent to all registered listeners.

Parameters: anchor the label text anchor (null not permitted).

See Also: getLabelTextAnchor

setOutlinePaint

public void setOutlinePaint(Paint paint)
Sets the outline paint and sends a MarkerChangeEvent to all registered listeners.

Parameters: paint the paint (null permitted).

See Also: getOutlinePaint

setOutlineStroke

public void setOutlineStroke(Stroke stroke)
Sets the outline stroke and sends a MarkerChangeEvent to all registered listeners.

Parameters: stroke the stroke (null permitted).

See Also: getOutlineStroke

setPaint

public void setPaint(Paint paint)
Sets the paint and sends a MarkerChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getPaint

setStroke

public void setStroke(Stroke stroke)
Sets the stroke and sends a MarkerChangeEvent to all registered listeners.

Parameters: stroke the stroke (null not permitted).

See Also: getStroke

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.