public abstract class Title extends AbstractBlock implements Block, java.lang.Cloneable, java.io.Serializable
Concrete implementations of this class will render text and images, and hence do the actual work of drawing titles.
| Modifier and Type | Field and Description |
|---|---|
static HorizontalAlignment |
DEFAULT_HORIZONTAL_ALIGNMENT
The default horizontal alignment.
|
static RectangleInsets |
DEFAULT_PADDING
Default title padding.
|
static RectangleEdge |
DEFAULT_POSITION
The default title position.
|
static VerticalAlignment |
DEFAULT_VERTICAL_ALIGNMENT
The default vertical alignment.
|
boolean |
visible
A flag that controls whether or not the title is visible.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Title()
Creates a new title, using default attributes where necessary.
|
protected |
Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment)
Creates a new title, using default attributes where necessary.
|
protected |
Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding)
Creates a new title.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
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(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.
|
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. |
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, trimToContentWidthpublic static final RectangleEdge DEFAULT_POSITION
public static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT
public static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT
public static final RectangleInsets DEFAULT_PADDING
public boolean visible
protected Title()
protected Title(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
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).protected Title(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, RectangleInsets padding)
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).public boolean isVisible()
true.setVisible(boolean)public void setVisible(boolean visible)
TitleChangeEvent to all registered listeners.visible - the new flag value.isVisible()public RectangleEdge getPosition()
null).public void setPosition(RectangleEdge position)
TitleChangeEvent to
all registered listeners.position - the position (null not permitted).public HorizontalAlignment getHorizontalAlignment()
null).public void setHorizontalAlignment(HorizontalAlignment alignment)
TitleChangeEvent to all registered listeners.alignment - the horizontal alignment (null not
permitted).public VerticalAlignment getVerticalAlignment()
null).public void setVerticalAlignment(VerticalAlignment alignment)
alignment - the new vertical alignment (TOP, MIDDLE or BOTTOM,
null not permitted).public boolean getNotify()
public void setNotify(boolean flag)
flag - the new value of the flag.public abstract void draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
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 class AbstractBlockjava.lang.CloneNotSupportedException - not thrown by this class, but it may
be thrown by subclasses.public void addChangeListener(TitleChangeListener listener)
listener - the object that is being registered.public void removeChangeListener(TitleChangeListener listener)
listener - the object that is being unregistered.protected void notifyListeners(TitleChangeEvent event)
event - an object that contains information about the change to
the title.public boolean equals(java.lang.Object obj)
equals in class AbstractBlockobj - the object (null not permitted).true or false.public int hashCode()
hashCode in class java.lang.Object