|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwheelsunh.etc.AbstractGraphic
wheelsunh.users.AbstractShape
wheelsunh.users.Shape
wheelsunh.users.RectangularShape
wheelsunh.users.RoundedRectangle
wheelsunh.users.ConversationBubble
public class ConversationBubble
Subclass of RoundedRectangle that will display a string, like conversation bubbles in cartoon.
Field Summary | |
---|---|
static int |
DEFAULT_BORDER_WIDTH
|
static int |
DEFAULT_WIDTH
|
static int |
TAIL_DIR_LEFT
|
static int |
TAIL_DIR_RIGHT
|
Fields inherited from class wheelsunh.users.Shape |
---|
_c, _dp, _shape, DEFAULT_COLOR |
Fields inherited from class wheelsunh.users.AbstractShape |
---|
_rot |
Constructor Summary | |
---|---|
ConversationBubble(java.lang.String text)
Constructs a ConversationBubble in the wheelsunh.users.Frame's DrawingPanel. |
|
ConversationBubble(java.lang.String text,
DrawingPanel dp)
Constructs a ConversationBubble displaying the specified String in the passed-in DrawingPanel. |
|
ConversationBubble(java.lang.String text,
DrawingPanel dp,
int tailDir)
Constructs a ConversationBubble displaying the specified String in the passed-in DrawingPanel. |
|
ConversationBubble(java.lang.String text,
int tailDir)
Constructs a ConversationBubble displaying the specified String in the wheelsunh.users.Frame's DrawingPanel. |
Method Summary | |
---|---|
void |
actualPaint(java.awt.Graphics2D g)
Normal users do not need to worry about this! Does the actual work to paint the conversation bubble. |
java.awt.Rectangle |
getBounds()
Returns the bounds of the conversation bubble. |
void |
hide()
Graphically hides the conversation bubble. |
void |
setBorderWidth(int width)
Changes the size of the border of whitespace between the text area and its frame. |
void |
setColor(java.awt.Color c)
Set the background and frame color of the ConversationBubble. |
void |
setFillColor(java.awt.Color c)
Set the background color of the ConversationBubble. |
void |
setLocation(java.awt.Point p)
Sets the location of the ConversationBubble. |
void |
setRotation(int degrees)
Overridden to do nothing. |
void |
setSize(java.awt.Dimension d)
Sets the size of the ConversationBubble. |
void |
setTail(int x,
int y)
Allows you to explicitly specify the point that the conversation bubble's "tail" extends from. |
void |
setTail(java.awt.Point p)
Allows you to explicitly specify the point that the conversation bubble's "tail" extends from. |
void |
setTailDirection(int dir)
Allows you to specify the direction in which the ConversationBubble's "tail"--the line that indicates the source of the conversation bubble. |
void |
setText(java.lang.String text)
Makes the bubble display the passed-in string. |
void |
setWidth(int width)
Sizes the ConversationBubble to the given width, but maintains full view of the contents by adjusting the height if necessary. |
void |
show()
Graphically shows the conversation bubble. |
Methods inherited from class wheelsunh.users.RectangularShape |
---|
getFillColor, getFrameColor, getFrameThickness, getHeight, getLocation, getSize, getWidth, getXLocation, getYLocation, setFrameColor, setFrameThickness, setLocation, setSize |
Methods inherited from class wheelsunh.users.Shape |
---|
contains, getColor, getRotation, paint |
Methods inherited from class wheelsunh.users.AbstractShape |
---|
boundsIntersects, center, distance, getCenter, getCenterX, getCenterY, getIntersection, intersects, intersects, setCenter |
Methods inherited from class wheelsunh.etc.AbstractGraphic |
---|
mouseClicked, mouseDragged, mousePressed, mouseReleased |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface wheelsunh.Colorable |
---|
getColor |
Field Detail |
---|
public static final int DEFAULT_WIDTH
public static final int DEFAULT_BORDER_WIDTH
public static final int TAIL_DIR_LEFT
public static final int TAIL_DIR_RIGHT
Constructor Detail |
---|
public ConversationBubble(java.lang.String text)
public ConversationBubble(java.lang.String text, int tailDir)
tailDir
.
text
- the String to displaytailDir
- the direction of the bubble's "tail." MUST be
either TAIL_DIR_LEFT or TAIL_DIR_RIGHT!
java.lang.IllegalArgumentException
- if tailDir
is not TAIL_DIR_LEFT or TAIL_DIR_RIGHTpublic ConversationBubble(java.lang.String text, DrawingPanel dp)
public ConversationBubble(java.lang.String text, DrawingPanel dp, int tailDir)
tailDir
.
text
- the String to displaydp
- the DrawingPanel in which the bubble will be drawntailDir
- the direction of the bubble's "tail." MUST be
either TAIL_DIR_LEFT or TAIL_DIR_RIGHT!
java.lang.IllegalArgumentException
- if tailDir
is not TAIL_DIR_LEFT or TAIL_DIR_RIGHTMethod Detail |
---|
public void setLocation(java.awt.Point p)
setLocation(int, int)
forward to setLocation(java.awt.Point)
, so either one
will work correctly.)
setLocation
in interface Locatable
setLocation
in class RectangularShape
public void setSize(java.awt.Dimension d)
setWidth(int)
to specify a width for the bubble while
maintaining view of all the text.
setSize
in interface Sizeable
setSize
in class RoundedRectangle
public void setWidth(int width)
public void show()
show
in class Shape
public void hide()
hide
in class Shape
public void setBorderWidth(int width)
public void setColor(java.awt.Color c)
setColor
in interface Colorable
setColor
in class RectangularShape
public void setFillColor(java.awt.Color c)
setFillColor
in interface AdvancedColorable
setFillColor
in class RectangularShape
public void setText(java.lang.String text)
public void actualPaint(java.awt.Graphics2D g)
actualPaint
in class RectangularShape
g
- the instance of java.awt.Graphics2D
that should
be used to paint the shapepublic java.awt.Rectangle getBounds()
getBounds
in class RectangularShape
public void setRotation(int degrees)
setRotation
in interface Rotatable
setRotation
in class Shape
degrees
- the magnitude of the rotation in degreespublic void setTail(java.awt.Point p)
public void setTail(int x, int y)
public void setTailDirection(int dir)
setTail
, the tail will now revert to its default
sizing at the specified direction.
dir
- the direction (must be TAIL_DIR_LEFT or TAIL_DIR_RIGHT)
java.lang.IllegalArgumentException
- if dir
is not
TAIL_DIR_LEFT or TAIL_DIR_RIGHT.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |