|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--uchicago.src.sim.gui.Display
|
+--uchicago.src.sim.gui.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.
| Field Summary |
| 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,
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,
Color textColor)
Constructs a TextDisplay to display text at the specified coordinates in the specified color. |
|
| Method Summary | |
void |
addLine(String val)
Adds a line of text to be displayed. |
void |
addLine(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. |
ArrayList |
getDisplayableInfo()
Gets a list of the DisplayInfo object associated with this Display. |
int |
getFontSize()
Gets the current font size. |
ArrayList |
getObjectsAt(int x,
int y)
Gets the objects at the coordinate x, y. |
Dimension |
getSize()
Gets the size of this TextDisplay. |
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(Color c)
Sets the color of the text and box. |
void |
setFontSize(int val)
Sets the font size of the text. |
void |
setHeader(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 |
reSize |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TextDisplay(int x,
int y,
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,
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 Dimension getSize()
getSize in interface DisplayablegetSize in class Displaypublic void setBoxVisible(boolean val)
public void setHeader(String header)
header - the headerpublic void addLine(String val)
val - the line to add
public void addLine(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(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 void drawDisplay(SimGraphics g)
drawDisplay in interface DisplayabledrawDisplay in class Displayg - the graphics context with which to drawpublic ArrayList getDisplayableInfo()
getDisplayableInfo in interface DisplayablegetDisplayableInfo in class DisplayDisplayInfopublic void viewEventPerformed(ViewEvent evt)
viewEventPerformed in interface DisplayableviewEventPerformed in class Display
public 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
|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||