Class Marker

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    CategoryMarker, IntervalMarker, ValueMarker

    public abstract class Marker
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.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.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Marker()
      Creates a new marker with default attributes.
      protected Marker​(java.awt.Paint paint)
      Constructs a new marker.
      protected Marker​(java.awt.Paint paint, java.awt.Stroke stroke, java.awt.Paint outlinePaint, java.awt.Stroke outlineStroke, float alpha)
      Constructs a new marker.
    • Constructor Detail

      • Marker

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

        protected Marker​(java.awt.Paint paint)
        Constructs a new marker.
        Parameters:
        paint - the paint (null not permitted).
      • Marker

        protected Marker​(java.awt.Paint paint,
                         java.awt.Stroke stroke,
                         java.awt.Paint outlinePaint,
                         java.awt.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:
        java.lang.IllegalArgumentException - if paint or stroke is null, or alpha is not in the specified range.
    • Method Detail

      • getPaint

        public java.awt.Paint getPaint()
        Returns the paint.
        Returns:
        The paint (never null).
        See Also:
        setPaint(Paint)
      • setPaint

        public void setPaint​(java.awt.Paint paint)
        Sets the paint and sends a MarkerChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getPaint()
      • getStroke

        public java.awt.Stroke getStroke()
        Returns the stroke.
        Returns:
        The stroke (never null).
        See Also:
        setStroke(Stroke)
      • setStroke

        public void setStroke​(java.awt.Stroke stroke)
        Sets the stroke and sends a MarkerChangeEvent to all registered listeners.
        Parameters:
        stroke - the stroke (nullnot permitted).
        See Also:
        getStroke()
      • getAlpha

        public float getAlpha()
        Returns the alpha transparency.
        Returns:
        The alpha transparency.
        See Also:
        setAlpha(float)
      • 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:
        java.lang.IllegalArgumentException - if alpha is not in the specified range.
        See Also:
        getAlpha()
      • getLabel

        public java.lang.String getLabel()
        Returns the label (if null no label is displayed).
        Returns:
        The label (possibly null).
        See Also:
        setLabel(String)
      • setLabel

        public void setLabel​(java.lang.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()
      • setLabelFont

        public void setLabelFont​(java.awt.Font font)
        Sets the label font and sends a MarkerChangeEvent to all registered listeners.
        Parameters:
        font - the font (null not permitted).
        See Also:
        getLabelFont()
      • setLabelPaint

        public void setLabelPaint​(java.awt.Paint paint)
        Sets the label paint and sends a MarkerChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
        See Also:
        getLabelPaint()
      • getLabelBackgroundColor

        public java.awt.Color getLabelBackgroundColor()
        Returns the label background color. The default value is Color(100, 100, 100, 100)..
        Returns:
        The label background color (never null).
        Since:
        1.0.18
      • setLabelBackgroundColor

        public void setLabelBackgroundColor​(java.awt.Color color)
        Sets the label background color.
        Parameters:
        color - the color (null not permitted).
        Since:
        1.0.18
      • getLabelAnchor

        public org.jfree.ui.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(RectangleAnchor)
      • setLabelAnchor

        public void setLabelAnchor​(org.jfree.ui.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()
      • setLabelOffset

        public void setLabelOffset​(org.jfree.ui.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()
      • 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
      • getListeners

        public java.util.EventListener[] getListeners​(java.lang.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
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests the marker for equality with an arbitrary object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object (null permitted).
        Returns:
        A boolean.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Creates a clone of the marker.
        Overrides:
        clone in class java.lang.Object
        Returns:
        A clone.
        Throws:
        java.lang.CloneNotSupportedException - never.