|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--uchicago.src.sim.gui.DisplaySurface
| Field Summary | |
protected JMenuBar |
bar
The menu bar for the DisplaySurface JFrame |
protected Dimension |
defaultSize
|
protected Hashtable |
displays
Dictionary of the Displays contained by this DisplaySurface. |
protected MouseInputAdapter |
dsMouseAdapter
|
protected WindowAdapter |
dsWindowAdapter
|
protected JFrame |
frame
The JFrame in which this DisplaySurface is displayed. |
protected ArrayList |
keyListeners
List of keyListeners for this DisplaySurface. |
protected Legend |
legend
|
protected Point |
location
|
protected JMenu |
menu
The option menu. |
protected SimModel |
model
The model associated with this display surface. |
protected boolean |
mousePressed
This is set to true via a mouse motion listener on the frame. |
protected MovieMaker |
movieMaker
|
protected String |
name
The name of this display. |
protected boolean |
needsUpdate
Whether or not this DisplaySurface needs to be updated. |
protected Painter |
painter
The Painter used by this DisplaySurface to do the actual drawing. |
protected ArrayList |
probeables
List of probeable displays. |
protected Dimension |
size
|
protected String |
snapshotFile
Filename for snapshots taken of this display surface. |
protected ArrayList |
zoomables
|
protected uchicago.src.sim.gui.DisplaySurface.Rect |
zoomRect
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface uchicago.src.sim.gui.MediaProducer |
MPEG, QUICK_TIME |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
DisplaySurface(Dimension size,
SimModel model,
String name)
Creates a DisplaySurface of the specified size and with the specified model and the specified name. |
|
DisplaySurface(SimModel model,
String name)
Creates a DisplaySurface for the specified model and with the specified name. |
|
DisplaySurface(SimModel model,
String name,
Painter painter)
Creates a DisplaySurface for the specified model, with the specified name and using the specified Painter. |
|
| Method Summary | |
void |
addDisplayable(Displayable display,
String name)
Adds a Displayable to the list of displayables that are displayed when updateDisplay is called. |
void |
addDisplayableProbeable(Displayable display,
String name)
Adds the specified Displayable to the displayables list and the probeables list. |
void |
addKeyListener(KeyListener listener)
|
void |
addLegendLabel(String label,
int iconType,
Color color,
boolean hollow)
|
void |
addLegendLabel(String label,
int iconType,
Color color,
boolean hollow,
int iconWidth,
int iconHeight)
|
void |
addMovieFrame()
Adds the currently displayed image as frame to a movie. |
void |
addProbeable(Probeable probeable)
Adds the specified Probeable to the list of probeables. |
void |
addZoomable(Zoomable zoomable)
|
void |
closeMovie()
Closes the movie, writing any remaining frames to the file. |
void |
componentHidden(ComponentEvent e)
|
void |
componentMoved(ComponentEvent e)
|
void |
componentResized(ComponentEvent e)
|
void |
componentShown(ComponentEvent e)
|
void |
createLegend(String title)
|
void |
display()
Displays this DisplaySurface, that is, makes it visible on the screen in a JFrame etc. |
void |
dispose()
Dispose this DisplaySurface |
JFrame |
getFrame()
Returns the JFrame for this DisplaySurface. |
JMenu |
getOptionsMenu()
Returns the options menu for this DisplaySurface. |
Dimension |
getPreferredSize()
Gets the preferred size of this DisplaySurface. |
boolean |
isFrameVisible()
|
void |
paint(Graphics g)
Paints this surface. |
void |
paintAll(Graphics g)
|
void |
paintComponents(Graphics g)
|
void |
removeDisplayable(Displayable display)
Removes the specified Displayable from the list of displayables to display |
void |
removeProbeable(Probeable probeable)
Removes the specified Probeable from the list of probeables. |
void |
removeProbeableDisplayable(Displayable display)
Removes the specified Displayable from the ist of displayables to display. |
void |
setBackground(Color c)
Sets the background color for this display |
void |
setLocation(int x,
int y)
Sets the screen location for this OpenGraph. |
void |
setMovieName(String fileName,
String movieType)
Sets the name and type of a movie. |
void |
setSnapshotFileName(String fileName)
Sets the snapshot file name. |
void |
simEventPerformed(SimEvent evt)
Repaints the display on a pause or a stop event. |
void |
takeSnapshot()
Takes a snapshot of the current displayed image and writes it to the file specified by setSnapshotFileName(String fileName). |
void |
update(Graphics g)
|
void |
updateDisplay()
Updates the display. |
void |
updateDisplayDirect()
Updates the display. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Painter painter
protected ArrayList probeables
protected JFrame frame
protected boolean needsUpdate
protected String snapshotFile
protected SimModel model
protected Hashtable displays
protected JMenu menu
protected JMenuBar bar
protected String name
protected MovieMaker movieMaker
protected Legend legend
protected ArrayList keyListeners
protected ArrayList zoomables
protected Point location
protected Dimension size
protected Dimension defaultSize
protected boolean mousePressed
protected uchicago.src.sim.gui.DisplaySurface.Rect zoomRect
protected WindowAdapter dsWindowAdapter
protected MouseInputAdapter dsMouseAdapter
| Constructor Detail |
public DisplaySurface(Dimension size,
SimModel model,
String name)
Object2DDisplay display = new Object2DDisplay(someGrid);
DisplaySurface ds = new DisplaySurface(display.getSize(), someModel,
"Display");
. The name appears in the title bar of the
actual screen window that contains the display.
size - the size of the DisplaySurfacemodel - the model associated with this display surfacename - the name that appears in the title bar of the physical
display
public DisplaySurface(SimModel model,
String name,
Painter painter)
Note that specifying your own Painter is an advanced feature and shouldn't be done unless you know what you are doing. Of course, if you've written your own Painter then you probably do.
model - the model associated with this display surfacename - the name that appears in the title bar of the physical
displaypainter - the Painter object used to do the actual painting of
the Displayables contained by this DisplaySurface.
public DisplaySurface(SimModel model,
String name)
model - the model associated with this display surfacename - the name that appears in the title bar of the physical
display| Method Detail |
public void setBackground(Color c)
setBackground in class JComponentc - the background color
public void addDisplayable(Displayable display,
String name)
updateDisplay is called.
display - the displayable to addname - the name of the displayable (is shown under the view menu)public void removeDisplayable(Displayable display)
display - the displayable to removepublic void addProbeable(Probeable probeable)
probeable - the probeable to addpublic void removeProbeable(Probeable probeable)
probeable - the probeable to removepublic void removeProbeableDisplayable(Displayable display)
display - the Displayable to removepublic void addZoomable(Zoomable zoomable)
public void addDisplayableProbeable(Displayable display,
String name)
display - the Displayable to add to this to DisplaySurface.name - the name of the displayable to add. Name will be shown
on the view menu
IllegalArgumentException - if the specified object
is not a probable and a displayablepublic void updateDisplay()
public void updateDisplayDirect()
public void paint(Graphics g)
paint in class JComponentpublic void paintComponents(Graphics g)
paintComponents in class Containerpublic void paintAll(Graphics g)
paintAll in class Componentpublic void update(Graphics g)
update in class JComponentpublic boolean isFrameVisible()
public void setLocation(int x,
int y)
setLocation in class Componentx - the x screen coordinatey - the y screen coordinatepublic void display()
public void dispose()
public void createLegend(String title)
public void addLegendLabel(String label,
int iconType,
Color color,
boolean hollow)
public void addLegendLabel(String label,
int iconType,
Color color,
boolean hollow,
int iconWidth,
int iconHeight)
public void setMovieName(String fileName,
String movieType)
setMovieName in interface MediaProducerfileName - the name of the moviemovieType - the type of movie (e.g. DisplaySurface.QUICK_TIME)public void addMovieFrame()
addMovieFrame in interface MediaProducerpublic void closeMovie()
closeMovie in interface MediaProducerpublic JMenu getOptionsMenu()
public JFrame getFrame()
public void setSnapshotFileName(String fileName)
setSnapshotFileName in interface MediaProducerfileName - then file name to record to image to.public void takeSnapshot()
takeSnapshot in interface MediaProducerpublic Dimension getPreferredSize()
getPreferredSize in class JComponentpublic void addKeyListener(KeyListener listener)
addKeyListener in class Componentpublic void simEventPerformed(SimEvent evt)
simEventPerformed in interface SimEventListenerpublic void componentShown(ComponentEvent e)
componentShown in interface ComponentListenerpublic void componentHidden(ComponentEvent e)
componentHidden in interface ComponentListenerpublic void componentMoved(ComponentEvent e)
componentMoved in interface ComponentListenerpublic void componentResized(ComponentEvent e)
componentResized in interface ComponentListener
|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||