public class PtolemyApplet extends BasicJApplet implements ExecutionListener
This class offers a number of alternatives that control the visual appearance of the applet. By default, the applet places on the screen a set of control buttons that can be used to start, stop, pause, and resume the model. Below those buttons, it places the visual elements of any actors in the model that implement the Placeable interface, such as plotters or textual output.
The applet parameters are:
To create a model in a different way, say without a modelClass applet parameter, you may extend this class and override the protected method _createModel(). If you wish to alter the way that the model is represented on the screen, you can extend this class an override the _createView() method. The rendition in this class is an instance of ModelPane.
This class provides a number of methods that might be useful even if its init() or _createModel() methods are not appropriate for a given applet. Specifically, it provides a mechanism for reporting errors and exceptions; and it provide an applet parameter for controlling the background color.
ModelPane
,
Placeable
,
Serialized FormYellow (johnr) |
Green (eal) |
javax.swing.JApplet.AccessibleJApplet
java.applet.Applet.AccessibleApplet
Modifier and Type | Field and Description |
---|---|
protected Manager |
_manager
The manager, created in the init() method.
|
protected boolean |
_setupOK
Set this to false if the setup of the model during the init()
method fails.
|
protected NamedObj |
_toplevel
The top-level composite actor, created in the init() method.
|
protected Workspace |
_workspace
The workspace that the applet is built in.
|
_background
accessibleContext, rootPane, rootPaneCheckingEnabled
Constructor and Description |
---|
PtolemyApplet() |
Modifier and Type | Method and Description |
---|---|
protected NamedObj |
_createModel(Workspace workspace)
Create a model.
|
protected javax.swing.JPanel |
_createRunControls(int numberOfButtons)
Deprecated.
Use the control applet parameter.
|
protected void |
_createView()
Create a ModelPane to control execution of the model and display
its results.
|
protected void |
_go()
Execute the model, if the manager is not currently executing.
|
protected void |
_stop()
Stop the execution.
|
void |
destroy()
Cleanup after execution of the model.
|
void |
executionError(Manager manager,
java.lang.Throwable throwable)
Report that an execute error occurred.
|
void |
executionFinished(Manager manager)
Report that execution of the model has finished.
|
java.lang.String |
getAppletInfo()
Return a string describing this applet.
|
java.lang.String[][] |
getParameterInfo()
Describe the applet parameters.
|
void |
init()
Initialize the applet.
|
void |
managerStateChanged(Manager manager)
Report that the manager state has changed.
|
void |
start()
Start execution of the model.
|
void |
stop()
Stop execution of the model.
|
_concatStringArrays, _getBackground, _stackTraceToString, report, report, report
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected Manager _manager
protected boolean _setupOK
protected NamedObj _toplevel
protected Workspace _workspace
public void destroy()
destroy
in class java.applet.Applet
public void executionError(Manager manager, java.lang.Throwable throwable)
executionError
in interface ExecutionListener
manager
- The manager in charge of the execution.throwable
- The throwable that triggered the error.public void executionFinished(Manager manager)
executionFinished
in interface ExecutionListener
manager
- The manager in charge of the execution.public java.lang.String getAppletInfo()
getAppletInfo
in class BasicJApplet
public java.lang.String[][] getParameterInfo()
getParameterInfo
in class BasicJApplet
public void init()
init
in class BasicJApplet
public void managerStateChanged(Manager manager)
managerStateChanged
in interface ExecutionListener
manager
- The manager controlling the execution.Manager.getState()
public void start()
start
in class java.applet.Applet
public void stop()
stop
in class java.applet.Applet
protected NamedObj _createModel(Workspace workspace) throws java.lang.Exception
workspace
- The workspace in which to create the model.java.lang.Exception
- If something goes wrong. This is a broad
exception to allow derived classes wide latitude as to which
exception to throw.@Deprecated protected javax.swing.JPanel _createRunControls(int numberOfButtons)
numberOfButtons
- How many buttons to create.protected void _createView()
protected void _go() throws IllegalActionException
IllegalActionException
- Not thrown in this base class.protected void _stop()