ptolemy.gui
Class BasicJApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--ptolemy.gui.BasicJApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class BasicJApplet
extends javax.swing.JApplet

Base class for swing applets. This class provides basic management for background colors, a standardized mechanism for reporting errors and exceptions, and a minimal amount of information about the applet.

The applet parameter is:

Since:
Ptolemy II 0.4
Version:
$Id: BasicJApplet.java,v 1.12 2002/02/21 18:48:14 cxh Exp $
Author:
Edward A. Lee
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.Color _background
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BasicJApplet()
           
 
Method Summary
protected  java.lang.String[][] _concatStringArrays(java.lang.String[][] first, java.lang.String[][] second)
          Concatenate two parameter info string arrays and return the result.
protected  java.awt.Color _getBackground()
          Deprecated. Use the public method getBackground() instead.
protected  java.lang.String _stackTraceToString(java.lang.Exception ex)
          Get the stack trace and return as a string.
 java.lang.String getAppletInfo()
          Return generic applet information.
 java.lang.String[][] getParameterInfo()
          Describe the applet parameters.
 void init()
          Initialize the applet.
 void report(java.lang.Exception ex)
          Report an exception.
 void report(java.lang.String message)
          Report a message to the user.
 void report(java.lang.String message, java.lang.Exception ex)
          Report an exception with an additional message.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, 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, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_background

protected java.awt.Color _background
Constructor Detail

BasicJApplet

public BasicJApplet()
Method Detail

getAppletInfo

public java.lang.String getAppletInfo()
Return generic applet information.
Overrides:
getAppletInfo in class java.applet.Applet
Returns:
A string giving minimal information about Ptolemy II.

getParameterInfo

public java.lang.String[][] getParameterInfo()
Describe the applet parameters. Derived classes should override this and append their own parameters. The protected method _concatStringArrays() is provided to make this easy to do.
Overrides:
getParameterInfo in class java.applet.Applet
Returns:
An array describing the applet parameters.

init

public void init()
Initialize the applet. This method is called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start() method is called. In this base class, this method reads the background color parameter. If the background color parameter has not been set, then the background color is set to white.
Overrides:
init in class java.applet.Applet

report

public void report(java.lang.Exception ex)
Report an exception. This prints a message to the standard error stream, followed by the stack trace, but displays on the screen only the error message associated with the exception.

report

public void report(java.lang.String message)
Report a message to the user. This shows the message on the browser's status bar.
Parameters:
message - The message to report.

report

public void report(java.lang.String message,
                   java.lang.Exception ex)
Report an exception with an additional message. This prints a message to standard error, followed by the stack trace, and pops up a window with the message and the message of the exception.

_concatStringArrays

protected java.lang.String[][] _concatStringArrays(java.lang.String[][] first,
                                                   java.lang.String[][] second)
Concatenate two parameter info string arrays and return the result. This is provided to make it easy for derived classes to override the getParameterInfo() method. The returned array has length equal to the sums of the lengths of the two arguments, and containing the arrays contained by the arguments.
Parameters:
first - The first string array.
second - The second string array.
Returns:
A concatenated string array.

_getBackground

protected java.awt.Color _getBackground()
Deprecated. Use the public method getBackground() instead.

Get the background color as set by the "background" applet parameter. This is protected so that derived classes can find out what the background color is. Derived classes may wish to know the color so they can match it in some of their components.

_stackTraceToString

protected java.lang.String _stackTraceToString(java.lang.Exception ex)
Get the stack trace and return as a string.
Parameters:
ex - The exception for which we want the stack trace.
Returns:
The stack trace.