ptolemy.gui
Class BasicJApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by ptolemy.gui.BasicJApplet
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer
Direct Known Subclasses:
PtolemyApplet, VergilApplet

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 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (eal)
Proposed Rating:
Red (eal)

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.Color _background
          The background color as set by the "background" applet parameter.
 
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.Throwable throwable)
          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.String message)
          Report a message to the user.
 void report(java.lang.String message, java.lang.Throwable throwable)
          Report an exception with an additional message.
 void report(java.lang.Throwable throwable)
          Report an exception.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, 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, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, 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, transferFocusUpCycle
 
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
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.

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.Throwable throwable)
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.

Parameters:
throwable - The throwable that triggered the error.

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.Throwable throwable)
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.

Parameters:
message - The message to report.
throwable - The throwable that triggered the error.

_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.

Returns:
The background color.

_stackTraceToString

protected java.lang.String _stackTraceToString(java.lang.Throwable throwable)
Get the stack trace and return as a string.

Parameters:
throwable - The exception for which we want the stack trace.
Returns:
The stack trace.