Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| # Header And More
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jfree.chart.title
Class Title

    java.lang.Object
      org.jfree.chart.block.AbstractBlock
          org.jfree.chart.title.Title

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, Block, org.jfree.ui.Drawable

Direct Known Subclasses:
  CompositeTitle, ImageTitle, LegendTitle, PaintScaleLegend, TextTitle

    public abstract class Title

extends AbstractBlock
implements Block, java.lang.Cloneable, java.io.Serializable

The base class for all chart titles. A chart can have multiple titles, appearing at the top, bottom, left or right of the chart.

Concrete implementations of this class will render text and images, and hence do the actual work of drawing titles.

See Also:
  Serialized Form

Field Summary
`static org.jfree.ui.HorizontalAlignment` | `DEFAULT_HORIZONTAL_ALIGNMENT` The default horizontal alignment.
`static org.jfree.ui.RectangleInsets` | `DEFAULT_PADDING` Default title padding.
`static org.jfree.ui.RectangleEdge` | `DEFAULT_POSITION` The default title position.
`static org.jfree.ui.VerticalAlignment` | `DEFAULT_VERTICAL_ALIGNMENT` The default vertical alignment.
`boolean` | `visible` A flag that controls whether or not the title is visible.

Constructor Summary
`protected` | `Title()` Creates a new title, using default attributes where necessary.
`protected` | `Title(org.jfree.ui.RectangleEdge position, org.jfree.ui.HorizontalAlignment horizontalAlignment, org.jfree.ui.VerticalAlignment verticalAlignment)` Creates a new title, using default attributes where necessary.
`protected` | `Title(org.jfree.ui.RectangleEdge position, org.jfree.ui.HorizontalAlignment horizontalAlignment, org.jfree.ui.VerticalAlignment verticalAlignment, org.jfree.ui.RectangleInsets padding)` Creates a new title.

Method Summary
`void` | `addChangeListener(TitleChangeListener listener)` Registers an object for notification of changes to the title.
`java.lang.Object` | `clone()` Returns a clone of the title.
`abstract void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)` Draws the title on a Java 2D graphics device (such as the screen or a printer).
`boolean` | `equals(java.lang.Object obj)` Tests an object for equality with this title.
`org.jfree.ui.HorizontalAlignment` | `getHorizontalAlignment()` Returns the horizontal alignment of the title.
`boolean` | `getNotify()` Returns the flag that indicates whether or not the notification mechanism is enabled.
`org.jfree.ui.RectangleEdge` | `getPosition()` Returns the position of the title.
`org.jfree.ui.VerticalAlignment` | `getVerticalAlignment()` Returns the vertical alignment of the title.
`int` | `hashCode()` Returns a hashcode for the title.
`boolean` | `isVisible()` Returns a flag that controls whether or not the title should be drawn.
`protected void` | `notifyListeners(TitleChangeEvent event)` Notifies all registered listeners that the chart title has changed in some way.
`void` | `removeChangeListener(TitleChangeListener listener)` Unregisters an object for notification of changes to the chart title.
`void` | `setHorizontalAlignment(org.jfree.ui.HorizontalAlignment alignment)` Sets the horizontal alignment for the title and sends a `TitleChangeEvent` to all registered listeners.
`void` | `setNotify(boolean flag)` Sets the flag that indicates whether or not the notification mechanism is enabled.
`void` | `setPosition(org.jfree.ui.RectangleEdge position)` Sets the position for the title and sends a `TitleChangeEvent` to all registered listeners.
`void` | `setVerticalAlignment(org.jfree.ui.VerticalAlignment alignment)` Sets the vertical alignment for the title, and notifies any registered listeners of the change.
`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.

Methods inherited from class org.jfree.chart.block.AbstractBlock
`arrange, arrange, calculateTotalHeight, calculateTotalWidth, drawBorder, getBorder, getBounds, getContentXOffset, getContentYOffset, getFrame, getHeight, getID, getMargin, getPadding, getWidth, setBorder, setBorder, setBounds, setFrame, setHeight, setID, setMargin, setMargin, setPadding, setPadding, setWidth, toContentConstraint, trimBorder, trimMargin, trimPadding, trimToContentHeight, trimToContentWidth`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jfree.chart.block.Block
`arrange, arrange, draw, getBounds, getID, setBounds, setID`

Field Detail

### DEFAULT_POSITION

    public static final org.jfree.ui.RectangleEdge DEFAULT_POSITION

  The default title position.

### DEFAULT_HORIZONTAL_ALIGNMENT

    public static final org.jfree.ui.HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT

  The default horizontal alignment.

### DEFAULT_VERTICAL_ALIGNMENT

    public static final org.jfree.ui.VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT

  The default vertical alignment.

### DEFAULT_PADDING

    public static final org.jfree.ui.RectangleInsets DEFAULT_PADDING

  Default title padding.

### visible

    public boolean visible

  A flag that controls whether or not the title is visible.

  Since:
    1.0.11

Constructor Detail

### Title

    protected Title()

  Creates a new title, using default attributes where necessary.

### Title

    protected Title(org.jfree.ui.RectangleEdge position,
                    org.jfree.ui.HorizontalAlignment horizontalAlignment,
                    org.jfree.ui.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(org.jfree.ui.RectangleEdge position,
                    org.jfree.ui.HorizontalAlignment horizontalAlignment,
                    org.jfree.ui.VerticalAlignment verticalAlignment,
                    org.jfree.ui.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.
  Since:
    1.0.11
  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.
  Since:
    1.0.11
  See Also:
    `isVisible()`

### getPosition

    public org.jfree.ui.RectangleEdge getPosition()

  Returns the position of the title.

  Returns:
    The title position (never `null`).

### setPosition

    public void setPosition(org.jfree.ui.RectangleEdge position)

  Sets the position for the title and sends a `TitleChangeEvent` to all registered listeners.

  Parameters:
    `position` - the position (`null` not permitted).

### getHorizontalAlignment

    public org.jfree.ui.HorizontalAlignment getHorizontalAlignment()

  Returns the horizontal alignment of the title.

  Returns:
    The horizontal alignment (never `null`).

### setHorizontalAlignment

    public void setHorizontalAlignment(org.jfree.ui.HorizontalAlignment alignment)

  Sets the horizontal alignment for the title and sends a `TitleChangeEvent` to all registered listeners.

  Parameters:
    `alignment` - the horizontal alignment (`null` not permitted).

### getVerticalAlignment

    public org.jfree.ui.VerticalAlignment getVerticalAlignment()

  Returns the vertical alignment of the title.

  Returns:
    The vertical alignment (never `null`).

### setVerticalAlignment

    public void setVerticalAlignment(org.jfree.ui.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(java.awt.Graphics2D g2,
                              java.awt.geom.Rectangle2D area)

  Draws the title on a Java 2D graphics device (such as the screen or a printer).

  Specified by:
    `draw` in interface `org.jfree.ui.Drawable`
  Parameters:
    `g2` - the graphics device.
    `area` - the area allocated for the title (subclasses should not draw outside this area).

### clone

    public java.lang.Object clone()
                           throws java.lang.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 `AbstractBlock`
  Returns:
    A clone of the title.
  Throws:
    `java.lang.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(java.lang.Object obj)

  Tests an object for equality with this title.

  Overrides:
    `equals` in class `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 `java.lang.Object`
  Returns:
    The hashcode.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| # Footer And More
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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