Class Title

    • Constructor Detail

      • Title

        protected Title()
        Creates a new title, using default attributes where necessary.
      • Title

        protected Title​(RectangleEdge position,
                        HorizontalAlignment horizontalAlignment,
                        VerticalAlignment verticalAlignment)
        Creates a new title, using default attributes where necessary.
        Parameters:
        position - the position of the title (null not permitted).
        horizontalAlignment - the horizontal alignment of the title (null not permitted).
        verticalAlignment - the vertical alignment of the title (null not permitted).
      • Title

        protected Title​(RectangleEdge position,
                        HorizontalAlignment horizontalAlignment,
                        VerticalAlignment verticalAlignment,
                        RectangleInsets padding)
        Creates a new title.
        Parameters:
        position - the position of the title (null not permitted).
        horizontalAlignment - the horizontal alignment of the title (LEFT, CENTER or RIGHT, null not permitted).
        verticalAlignment - the vertical alignment of the title (TOP, MIDDLE or BOTTOM, null not permitted).
        padding - the amount of space to leave around the outside of the title (null not permitted).
    • Method Detail

      • isVisible

        public boolean isVisible()
        Returns a flag that controls whether or not the title should be drawn. The default value is true.
        Returns:
        A boolean.
        See Also:
        setVisible(boolean)
      • setVisible

        public void setVisible​(boolean visible)
        Sets a flag that controls whether or not the title should be drawn, and sends a TitleChangeEvent to all registered listeners.
        Parameters:
        visible - the new flag value.
        See Also:
        isVisible()
      • getPosition

        public RectangleEdge getPosition()
        Returns the position of the title.
        Returns:
        The title position (never null).
      • setPosition

        public void setPosition​(RectangleEdge position)
        Sets the position for the title and sends a TitleChangeEvent to all registered listeners.
        Parameters:
        position - the position (null not permitted).
      • setVerticalAlignment

        public void setVerticalAlignment​(VerticalAlignment alignment)
        Sets the vertical alignment for the title, and notifies any registered listeners of the change.
        Parameters:
        alignment - the new vertical alignment (TOP, MIDDLE or BOTTOM, null not permitted).
      • getNotify

        public boolean getNotify()
        Returns the flag that indicates whether or not the notification mechanism is enabled.
        Returns:
        The flag.
      • setNotify

        public void setNotify​(boolean flag)
        Sets the flag that indicates whether or not the notification mechanism is enabled. There are certain situations (such as cloning) where you want to turn notification off temporarily.
        Parameters:
        flag - the new value of the flag.
      • draw

        public abstract void draw​(Graphics2D g2,
                                  Rectangle2D area)
        Draws the title on a Java 2D graphics device (such as the screen or a printer).
        Specified by:
        draw in interface Drawable
        Parameters:
        g2 - the graphics device.
        area - the area allocated for the title (subclasses should not draw outside this area).
      • clone

        public Object clone()
                     throws CloneNotSupportedException
        Returns a clone of the title.

        One situation when this is useful is when editing the title properties - you can edit a clone, and then it is easier to cancel the changes if necessary.

        Overrides:
        clone in class org.jfree.chart.block.AbstractBlock
        Returns:
        A clone of the title.
        Throws:
        CloneNotSupportedException - not thrown by this class, but it may be thrown by subclasses.
      • addChangeListener

        public void addChangeListener​(TitleChangeListener listener)
        Registers an object for notification of changes to the title.
        Parameters:
        listener - the object that is being registered.
      • removeChangeListener

        public void removeChangeListener​(TitleChangeListener listener)
        Unregisters an object for notification of changes to the chart title.
        Parameters:
        listener - the object that is being unregistered.
      • notifyListeners

        protected void notifyListeners​(TitleChangeEvent event)
        Notifies all registered listeners that the chart title has changed in some way.
        Parameters:
        event - an object that contains information about the change to the title.
      • equals

        public boolean equals​(Object obj)
        Tests an object for equality with this title.
        Overrides:
        equals in class org.jfree.chart.block.AbstractBlock
        Parameters:
        obj - the object (null not permitted).
        Returns:
        true or false.
      • hashCode

        public int hashCode()
        Returns a hashcode for the title.
        Overrides:
        hashCode in class org.jfree.chart.block.AbstractBlock
        Returns:
        The hashcode.