org.jfree.chart.title
Class Title
- Block, Cloneable, Drawable, Serializable
public abstract class Title
implements Block, Cloneable, 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.
Title() - Creates a new title, using default attributes where necessary.
|
Title(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) - Creates a new title, using default attributes where necessary.
|
Title(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, RectangleInsets padding) - Creates a new title.
|
void | addChangeListener(TitleChangeListener listener) - Registers an object for notification of changes to the title.
|
Object | clone() - Returns a clone of the title.
|
abstract void | draw(Graphics2D g2, Rectangle2D area) - Draws the title on a Java 2D graphics device (such as the screen or a
printer).
|
boolean | equals(Object obj) - Tests an object for equality with this title.
|
HorizontalAlignment | getHorizontalAlignment() - Returns the horizontal alignment of the title.
|
boolean | getNotify() - Returns the flag that indicates whether or not the notification
mechanism is enabled.
|
RectangleEdge | getPosition() - Returns the position of the title.
|
VerticalAlignment | getVerticalAlignment() - Returns the vertical alignment of the title.
|
int | hashCode() - Returns a hashcode for the title.
|
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(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(RectangleEdge position) - Sets the position for the title and sends a
TitleChangeEvent to
all registered listeners.
|
void | setVerticalAlignment(VerticalAlignment alignment) - Sets the vertical alignment for the title, and notifies any registered
listeners of the change.
|
arrange , arrange , calculateTotalHeight , calculateTotalWidth , clone , drawBorder , equals , 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 |
DEFAULT_PADDING
public static final RectangleInsets DEFAULT_PADDING
Default title padding.
DEFAULT_POSITION
public static final RectangleEdge DEFAULT_POSITION
The default title position.
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.
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.
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).
addChangeListener
public void addChangeListener(TitleChangeListener listener)
Registers an object for notification of changes to the title.
listener
- the object that is being registered.
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.
- clone in interface AbstractBlock
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).
g2
- the graphics device.area
- the area allocated for the title (subclasses should not
draw outside this area).
equals
public boolean equals(Object obj)
Tests an object for equality with this title.
- equals in interface AbstractBlock
obj
- the object (null
not permitted).
getHorizontalAlignment
public HorizontalAlignment getHorizontalAlignment()
Returns the horizontal alignment of the title.
- The horizontal alignment (never
null
).
getNotify
public boolean getNotify()
Returns the flag that indicates whether or not the notification
mechanism is enabled.
getPosition
public RectangleEdge getPosition()
Returns the position of the title.
- The title position (never
null
).
getVerticalAlignment
public VerticalAlignment getVerticalAlignment()
Returns the vertical alignment of the title.
- The vertical alignment (never
null
).
hashCode
public int hashCode()
Returns a hashcode for the title.
notifyListeners
protected void notifyListeners(TitleChangeEvent event)
Notifies all registered listeners that the chart title has changed in
some way.
event
- an object that contains information about the change to
the title.
removeChangeListener
public void removeChangeListener(TitleChangeListener listener)
Unregisters an object for notification of changes to the chart title.
listener
- the object that is being unregistered.
setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignment alignment)
Sets the horizontal alignment for the title and sends a
TitleChangeEvent
to all registered listeners.
alignment
- the horizontal alignment (null
not
permitted).
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.
flag
- the new value of the flag.
setPosition
public void setPosition(RectangleEdge position)
Sets the position for the title and sends a
TitleChangeEvent
to
all registered listeners.
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.
alignment
- the new vertical alignment (TOP, MIDDLE or BOTTOM,
null
not permitted).