Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class TextBalloon

    java.lang.Object
      TextBalloon

Direct Known Subclasses:
  SpeechBalloon, ThoughtBalloon

    public abstract class TextBalloon

extends Object

TextBalloon: this is used to represent objects in comic strips which are used to show what a character is saying or thinking. The tip of tail points to the character who is talking or thinking the text

Author:
  Barb Ericson

Constructor Summary
`TextBalloon(Point uLeft, int theWidth, Point tEnd, String theMessage)` Constructor that takes the upper left, width, tail end, and message to display

Method Summary
`void` | `draw(Graphics g)` Method to draw the text ballon using the passed graphics context
`protected void` | `drawBalloon(int ellipseHeight, Color fillColor, Color outlineColor, Graphics2D g2)` Method to draw the speech balloon
`protected abstract void` | `drawTail(int ellipseHeight, Color fillColor, Color outlineColor, Graphics2D g2)` Method to draw the tail of the balloon
`protected void` | `drawText(LineBreakMeasurer measurer, Color textColor, Graphics2D g2)` Method to draw the text in the balloon
`protected AttributedCharacterIterator` | `getAttrIterator()` Method to get the attributed character iterator used to display the text
`Font` | `getFont()` Method to get the font used to display the message
`int` | `getHeight(Graphics2D g2, AttributedCharacterIterator attrCharIter)` Method to get the height of the balloon
`int` | `getMargin()` Method to get the margin
`String` | `getMessage()` Method to get the message that is displayed in the balloon
`int` | `getNumLines()` Method to get the number of lines of text.
`Point` | `getTailEnd()` Method to get the point that is the end of the tail that indicates who is speaking
`Point` | `getUpperLeft()` Method to get the upper left point of the rectangle that encloses the balloon
`int` | `getWidth()` Method to get the width of the rectangle that encloses the balloon
`void` | `setFont(Font theFont)` Method to set the font used to display the balloon
`void` | `setMargin(int theMargin)` Method to set the margin
`void` | `setMessage(String theMessage)` Method to set the message that is displayed in the balloon
`void` | `setTailEnd(Point p)` Method to set the end point of the tail which indicates who is speaking
`void` | `setUpperLeft(Point p)` Method to set the upper left point of the rectangle that encloses the balloon
`void` | `setWidth(int theWidth)` Method to set the width of the rectangle that encloses the balloon

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

Constructor Detail

### TextBalloon

    public TextBalloon(Point uLeft,
                       int theWidth,
                       Point tEnd,
                       String theMessage)

  Constructor that takes the upper left, width, tail end, and message to display

  Parameters:
    `uLeft` - the upper left corner of a rectangle enclosing the balloon
    `theWidth` - the width of the enclosing rectangle
    `tEnd` - the point which is the end of the tail that shows who is speaking or thinking
    `theMessage` - the message to display

Method Detail

### getUpperLeft

    public Point getUpperLeft()

  Method to get the upper left point of the rectangle that encloses the balloon

  Returns:
    the upper left point

### setUpperLeft

    public void setUpperLeft(Point p)

  Method to set the upper left point of the rectangle that encloses the balloon

  Parameters:
    `p` - the upper left point to use

### getWidth

    public int getWidth()

  Method to get the width of the rectangle that encloses the balloon

  Returns:
    the width of the enclosing rectangle

### setWidth

    public void setWidth(int theWidth)

  Method to set the width of the rectangle that encloses the balloon

  Parameters:
    `theWidth` - the new width to use

### getMargin

    public int getMargin()

  Method to get the margin

  Returns:
    the margin in pixels

### setMargin

    public void setMargin(int theMargin)

  Method to set the margin

  Parameters:
    `theMargin` - the new margin to use

### getTailEnd

    public Point getTailEnd()

  Method to get the point that is the end of the tail that indicates who is speaking

  Returns:
    the end point of the tail

### setTailEnd

    public void setTailEnd(Point p)

  Method to set the end point of the tail which indicates who is speaking

  Parameters:
    `p` - the end point to use

### getMessage

    public String getMessage()

  Method to get the message that is displayed in the balloon

  Returns:
    the message to display

### setMessage

    public void setMessage(String theMessage)

  Method to set the message that is displayed in the balloon

  Parameters:
    `theMessage` - the message to use

### getFont

    public Font getFont()

  Method to get the font used to display the message

  Returns:
    the font used

### setFont

    public void setFont(Font theFont)

  Method to set the font used to display the balloon

  Parameters:
    `theFont` - the font to use

### getNumLines

    public int getNumLines()

  Method to get the number of lines of text. This will be 0 until getHeight is called and then it will be set correctly.

  Returns:
    the number of lines of text

### getHeight

    public int getHeight(Graphics2D g2,
                         AttributedCharacterIterator attrCharIter)

  Method to get the height of the balloon

  Parameters:
    `g2` - the grahics 2d context to draw in
    `attrCharIter` - the attributed character iterator that is used to display the text
  Returns:
    the height in pixels

### getAttrIterator

    protected AttributedCharacterIterator getAttrIterator()

  Method to get the attributed character iterator used to display the text

  Returns:
    the attributed character iterator

### drawBalloon

    protected void drawBalloon(int ellipseHeight,
                               Color fillColor,
                               Color outlineColor,
                               Graphics2D g2)

  Method to draw the speech balloon

  Parameters:
    `ellipseHeight` - the height of the ellipse
    `fillColor` - the color to fill with
    `outlineColor` - the color to outline with
    `g2` - the 2d graphics context

### drawText

    protected void drawText(LineBreakMeasurer measurer,
                            Color textColor,
                            Graphics2D g2)

  Method to draw the text in the balloon

  Parameters:
    `measurer` - the line break measurer
    `textColor` - the color to draw the text in
    `g2` - the 2d graphics context

### drawTail

    protected abstract void drawTail(int ellipseHeight,
                                     Color fillColor,
                                     Color outlineColor,
                                     Graphics2D g2)

  Method to draw the tail of the balloon

### draw

    public void draw(Graphics g)

  Method to draw the text ballon using the passed graphics context

  Parameters:
    `g` - the graphics context to draw on

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD