edu.mit.ai.psg.ui.patches
Class FrameableApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.mit.ai.psg.ui.patches.FrameableApplet
Direct Known Subclasses:
JevaESGUI, JevaGUI, JexaApplet

public abstract class FrameableApplet
extends Applet

FramableApplet extends Applet with the following:

See Also:
Serialized Form

Field Summary
protected static String pkBgColor
          applet parameter keyword: background color
protected static String pkTextColor
          applet parameter keyword
protected static String pkTitle
          applet parameter keyword
static Font titleFont
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
FrameableApplet()
           
 
Method Summary
 List getAppletList()
          utility: like AppletContext.getApplets(), but returns a List.
 String getAppletTitle()
          default applet title: getParameter(pkTitle) or ""
protected  String getButtonStartedText()
          default: "Started Frame"
protected  String getButtonStartingText()
          default: "Staring Frame"
protected  String getButtonStartText()
          default: "Start Frame"
protected abstract  Dimension getMinSizeAsButton()
           
protected abstract  Dimension getMinSizeInPlace()
           
 String getParameter(String name)
          extends super.getParameter() to catch NullPointerException and return null in case this is not being used as an applet
 String[][] getParameterInfo()
          Applet parameters: title textColor: HTML color for text bgColor: HTML color for background
 Icon getTitleIcon()
           
 void init()
          Default applet startup based on applet size:
protected  void initAppletColors(Component component)
          This method can be used to initialize applet foreground and background colors from applet parameters "textColor" and "bgColor".
 void initButtonForFrameApplet()
          Display a button on page for starting a separate frame.
 Frame initFrameApplet()
          Default behavior to be overridden or extended:
 void initPanelInPlaceApplet()
          Initialization for displaying applet in place on page.
 Button makeButtonForFrame()
          Creates new button initialized with getButtonStartText() Starts up window frame when applet button is pushed:
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, 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, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, 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, 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, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, 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

titleFont

public static Font titleFont

pkTitle

protected static final String pkTitle
applet parameter keyword

pkTextColor

protected static final String pkTextColor
applet parameter keyword

pkBgColor

protected static final String pkBgColor
applet parameter keyword: background color
Constructor Detail

FrameableApplet

public FrameableApplet()
Method Detail

getMinSizeInPlace

protected abstract Dimension getMinSizeInPlace()
See Also:
init()

getMinSizeAsButton

protected abstract Dimension getMinSizeAsButton()
See Also:
init()

init

public void init()
Default applet startup based on applet size:
initAppletColors(java.awt.Component)(this);
if (getSize() >= getMinSizeInPlace())
. initPanelInPlaceApplet()
else if (getSize() >= getMinSizeAsButton())
. initButtonForFrameApplet() 
else
. initFrameApplet()
Overrides:
init in class Applet

getAppletTitle

public String getAppletTitle()
default applet title: getParameter(pkTitle) or ""

getTitleIcon

public Icon getTitleIcon()

initPanelInPlaceApplet

public void initPanelInPlaceApplet()
Initialization for displaying applet in place on page. Makes sure layout is BorderLayout. Creates a frame-like titlebar pane and does this.add(titleBar, BorderLayout.NORTH). Titlebar contains a button which enables applet to be recreated as a window frame.
See Also:
getParameterInfo()

initButtonForFrameApplet

public void initButtonForFrameApplet()
Display a button on page for starting a separate frame. Suggested applet size: 200 x 30
See Also:
getParameterInfo()

getButtonStartText

protected String getButtonStartText()
default: "Start Frame"

getButtonStartingText

protected String getButtonStartingText()
default: "Staring Frame"

getButtonStartedText

protected String getButtonStartedText()
default: "Started Frame"

makeButtonForFrame

public Button makeButtonForFrame()
Creates new button initialized with getButtonStartText() Starts up window frame when applet button is pushed:
button.setLabel(applet.getButtonStartingText());
applet.initFrameApplet();
button.setLabel(applet.getButtonStartedText());

initFrameApplet

public Frame initFrameApplet()
Default behavior to be overridden or extended:
Frame window = new CloseableFrame(getAppletTitle());
initAppletColors(java.awt.Component)(window);
return window;
(Need to do window.show() once it is initialized with applet's components.)
See Also:
getParameterInfo()

initAppletColors

protected void initAppletColors(Component component)
This method can be used to initialize applet foreground and background colors from applet parameters "textColor" and "bgColor".
See Also:
HTMLColor.decode(java.lang.String)

getParameterInfo

public String[][] getParameterInfo()
Applet parameters:
Overrides:
getParameterInfo in class Applet

getParameter

public String getParameter(String name)
extends super.getParameter() to catch NullPointerException and return null in case this is not being used as an applet
Overrides:
getParameter in class Applet

getAppletList

public List getAppletList()
utility: like AppletContext.getApplets(), but returns a List. (Note that this may force some applets to be created that are not yet showing.)

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu