|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.gui.Display
uchicago.src.sim.gui.TextDisplay
public class TextDisplay
A Display class that can be used to display lines of text on a DisplaySurface. The text is optionally displayed enclosed in a rectangle. The text can remain static or can be changed by calling clearLines or clearLine and then adding new lines.
| Nested Class Summary | |
|---|---|
static class |
TextDisplay.Box
|
| Field Summary | |
|---|---|
protected TextDisplay.Box |
box
|
protected java.awt.Font |
curFont
|
protected boolean |
drawBox
|
protected java.lang.String |
header
|
protected java.util.ArrayList |
text
|
protected java.awt.Color |
textColor
|
| Fields inherited from class uchicago.src.sim.gui.Display |
|---|
height, view, width |
| Fields inherited from interface uchicago.src.sim.gui.Displayable |
|---|
TOGGLE_LINKS, TOGGLE_NODES, TOGGLE_UPDATE_LAYOUT, TOGGLE_VIEW, TOGGLE_WRAP |
| Constructor Summary | |
|---|---|
TextDisplay(int x,
int y,
java.awt.Color textColor)
Constructs a TextDisplay to display text at the specified coordinates in the specified color. |
|
TextDisplay(int width,
int height,
int x,
int y,
java.awt.Color textColor)
Constructs a TextDisplay to display text at the specified coordinates in the specified color. |
|
| Method Summary | |
|---|---|
void |
addLine(java.lang.String val)
Adds a line of text to be displayed. |
void |
addLine(java.lang.String val,
int index)
Adds a line of text at the specified index (relative to the other lines. |
void |
clearLine(int index)
Removes the line at the specified index. |
void |
clearLines()
Clears the list of lines to be displayed. |
void |
drawDisplay(SimGraphics g)
Does the actual drawing using the SimGraphics parameter. |
TextDisplay.Box |
getBoundingBox()
Returns the Box that bounds the displayed text in this TextDisplay. |
java.util.ArrayList |
getDisplayableInfo()
Gets a list of the DisplayInfo object associated with this Display. |
int |
getFontSize()
Gets the current font size. |
java.util.ArrayList |
getObjectsAt(int x,
int y)
Gets the objects at the coordinate x, y. |
int |
getX()
Gets the x coordinate for displaying text. |
int |
getY()
Gets the y coordinate for displaying text. |
void |
setBoxVisible(boolean val)
Sets whether the text should be drawn enclosed in a retangle. |
void |
setColor(java.awt.Color c)
Sets the color of the text and box. |
void |
setFontSize(int val)
Sets the font size of the text. |
void |
setHeader(java.lang.String header)
Sets an optional header for the displayed text. |
void |
setMoveableXY(Moveable moveable,
int x,
int y)
Sets the new coordinates for specified moveable. |
void |
setTextCoordinates(int x,
int y)
Sets the coordinates for displaying the lines of text. |
void |
setX(int x)
Sets the x coordinate for displaying text. |
void |
setY(int y)
Sets the Y coordinate for displaying text. |
void |
viewEventPerformed(ViewEvent evt)
Invoked when a viewEvent for this display is fired by the DisplaySurface. |
| Methods inherited from class uchicago.src.sim.gui.Display |
|---|
getSize, reSize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.awt.Color textColor
protected boolean drawBox
protected java.util.ArrayList text
protected java.lang.String header
protected java.awt.Font curFont
protected TextDisplay.Box box
| Constructor Detail |
|---|
public TextDisplay(int x,
int y,
java.awt.Color textColor)
setBoxVisible(), x and y
mark the top left corner of this box. If the text is not drawn
inside a box then x and y mark the position of the baseline of
left-most character in the first string to be drawn.
x - the x coordinatey - the y coordinatetextColor - the color to draw the text and box
public TextDisplay(int width,
int height,
int x,
int y,
java.awt.Color textColor)
setBoxVisible(), x and y
mark the top left corner of this box. If the text is not drawn
inside a box then x and y mark the position of the baseline of
left-most character in the first string to be drawn.
width - the width of the displayheight - the height of the displayx - the x coordinatey - the y coordinatetextColor - the color to draw the text and box| Method Detail |
|---|
public void setBoxVisible(boolean val)
public void setHeader(java.lang.String header)
header - the headerpublic void addLine(java.lang.String val)
val - the line to add
public void addLine(java.lang.String val,
int index)
val - the line to addindex - where to add the line relative to other linespublic void clearLines()
public void clearLine(int index)
index - the index of the line to removepublic void setColor(java.awt.Color c)
c - the color of the text and boxpublic void setFontSize(int val)
val - the font sizepublic int getFontSize()
public void setTextCoordinates(int x,
int y)
x - the x coordinatey - the y coordinatepublic int getX()
public void setX(int x)
x - the x coordinatepublic int getY()
public void setY(int y)
y - the y coordinatepublic TextDisplay.Box getBoundingBox()
public void drawDisplay(SimGraphics g)
drawDisplay in interface DisplayabledrawDisplay in class Displayg - the graphics context with which to drawpublic java.util.ArrayList getDisplayableInfo()
getDisplayableInfo in interface DisplayablegetDisplayableInfo in class DisplayDisplayInfopublic void viewEventPerformed(ViewEvent evt)
viewEventPerformed in interface DisplayableviewEventPerformed in class Display
public java.util.ArrayList getObjectsAt(int x,
int y)
Probeable
getObjectsAt in interface Probeablex - the x screen coordinate.y - the y screen coordinate.
public void setMoveableXY(Moveable moveable,
int x,
int y)
setMoveableXY in interface Probeablemoveable - the moveable whose coordinates are changedx - the x coordinate in pixelsy - the y coordinate in pixels
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||