All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class mesquite.lib.StringInABox

java.lang.Object
   |
   +----mesquite.lib.StringInABox

public class StringInABox
extends java.lang.Object
A utility class to draw a string in a box, useful for printing and screen display. A bit like TextArea, but without rectangle around it and with multipage printing facility. The string, font, and width are given to it, and it calculates a breakdown of the string into an array of strings each of which will fit in the allotted width, and also calcualted is how high of a rectangle is needed to accommodate all of the text.


Constructor Index

 o StringInABox(String, Font, int)
 o StringInABox(StringBuffer, Font, int)

Method Index

 o draw(Graphics, int, int)
draw text based at x, y
 o draw(Graphics, int, int, int, int)
draw text based at x, y, starting at local position y in box for height h
 o draw(Graphics, int, int, int, int, Component, boolean)
draw text based at x, y, starting at local position y in box for height h
 o drawInBox(Graphics, Color, int, int)
draw text based at x, y
 o getHeight()
 o getRemainingHeight(int)
 o getString()
 o getWidth()
 o printText(Frame, String, Font)
Prints the passed string (automatically prints with full page width and on multiple pages as needed.
 o printText(PrintJob, String, Font)
Prints the passed string using given PrintJob (automatically prints with full page width and on multiple pages as needed.
 o setBuffer(int)
 o setFont(Font)
 o setString(String)
 o setString(StringBuffer)
 o setWidth(int)

Constructors

 o StringInABox
 public StringInABox(java.lang.StringBuffer s,
                     java.awt.Font f,
                     int w)
 o StringInABox
 public StringInABox(java.lang.String s,
                     java.awt.Font f,
                     int w)

Methods

 o setBuffer
 public void setBuffer(int b)
 o setFont
 public void setFont(java.awt.Font f)
 o setWidth
 public void setWidth(int w)
 o getWidth
 public int getWidth()
 o setString
 public void setString(java.lang.StringBuffer s)
 o setString
 public void setString(java.lang.String s)
 o getString
 public java.lang.String getString()
 o printText
 public static void printText(java.awt.Frame f,
                              java.lang.String s,
                              java.awt.Font font)
Prints the passed string (automatically prints with full page width and on multiple pages as needed. \n are used as linebreads. Text is wrapped as necessary to fit onto page

 o printText
 public static void printText(java.awt.PrintJob pjob,
                              java.lang.String s,
                              java.awt.Font font)
Prints the passed string using given PrintJob (automatically prints with full page width and on multiple pages as needed. \n are used as linebreads. Text is wrapped as necessary to fit onto page

 o draw
 public int draw(java.awt.Graphics g,
                 int x,
                 int y,
                 int yPos,
                 int h,
                 java.awt.Component component,
                 boolean drawHorizontal)
draw text based at x, y, starting at local position y in box for height h

 o draw
 public int draw(java.awt.Graphics g,
                 int x,
                 int y,
                 int yPos,
                 int h)
draw text based at x, y, starting at local position y in box for height h

 o draw
 public int draw(java.awt.Graphics g,
                 int x,
                 int y)
draw text based at x, y

 o drawInBox
 public int drawInBox(java.awt.Graphics g,
                      java.awt.Color backgroundColor,
                      int x,
                      int y)
draw text based at x, y

 o getHeight
 public int getHeight()
 o getRemainingHeight
 public int getRemainingHeight(int usedSoFar)

All Packages  Class Hierarchy  This Package  Previous  Next  Index