java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
riso.general.MainFrame
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.applet.AppletContext, java.applet.AppletStub, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable
- public class MainFrame
- extends java.awt.Frame
- implements java.lang.Runnable, java.applet.AppletStub, java.applet.AppletContext
Run an Applet as an application.
This class was written by Jef Poskanzer, and it is redistributed as part of the RISO
project under the terms stated in the comments of the source file.
Using this class you can add a trivial main program to any Applet
and run it directly, as well as from a browser or the appletviewer.
And unlike some versions of this concept, MainFrame implements both
images and sound.
Sample main program:
public static void main( String[] args )
{
new Acme.MainFrame( new ThisApplet(), args, 400, 400 );
}
The only methods you need to know about are the constructors.
You can specify Applet parameters on the command line, as name=value.
For instance, the equivalent of:
<PARAM NAME="pause" VALUE="200">
would just be:
pause=200
You can also specify three special parameters:
width=N Width of the Applet.
height=N Height of the Applet.
barebones=true Leave off the menu bar and status area.
Fetch the software.
Fetch the entire Acme package.
| Nested classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
| Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Window |
|
| Fields inherited from class java.awt.Container |
|
| Methods inherited from class java.awt.Frame |
addNotify, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.awt.Window |
addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getGraphicsConfiguration, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusDownCycle, update, 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, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
args
private java.lang.String[] args
instances
private static int instances
name
private java.lang.String name
barebones
private boolean barebones
applet
private java.applet.Applet applet
label
private java.awt.Label label
appletSize
private java.awt.Dimension appletSize
PARAM_PROP_PREFIX
private static final java.lang.String PARAM_PROP_PREFIX
- See Also:
- Constant Field Values
MainFrame
public MainFrame(java.applet.Applet applet,
java.lang.String[] args,
int width,
int height)
MainFrame
public MainFrame(java.applet.Applet applet,
java.lang.String[] args)
MainFrame
public MainFrame(java.applet.Applet applet,
int width,
int height)
build
private void build(java.applet.Applet applet,
java.lang.String[] args,
int width,
int height)
parseArgs
private static void parseArgs(java.lang.String[] args,
java.util.Properties props)
handleEvent
public boolean handleEvent(java.awt.Event evt)
- Description copied from class:
java.awt.Component
- AWT 1.0 event handler.
This method calls one of the event-specific handler methods. For
example for key events, either Component.keyDown(Event,int)>
Component.keyDown(Event,int) 55
or Component.keyUp(Event,int)>Component.keyUp(Event,int) 55 is called. A derived
component can override one of these event-specific methods if it
only needs to handle certain event types. Otherwise it can
override handleEvent itself and handle any event.
run
public void run()
- Description copied from interface:
java.lang.Runnable
- This method will be called by whoever wishes to run your class
implementing Runnable. Note that there are no restrictions on what
you are allowed to do in the run method, except that you cannot
throw a checked exception.
- Specified by:
run in interface java.lang.Runnable
isActive
public boolean isActive()
- Description copied from interface:
java.applet.AppletStub
- Tests whether or not this applet is currently active. An applet is active
just before the browser invokes start(), and becomes inactive just
before the browser invokes stop().
- Specified by:
isActive in interface java.applet.AppletStub
getDocumentBase
public java.net.URL getDocumentBase()
- Description copied from interface:
java.applet.AppletStub
- Returns the basename URL of the document this applet is embedded in. This
is everything up to the final '/'.
- Specified by:
getDocumentBase in interface java.applet.AppletStub
getCodeBase
public java.net.URL getCodeBase()
- Description copied from interface:
java.applet.AppletStub
- Returns the URL of the code base for this applet.
- Specified by:
getCodeBase in interface java.applet.AppletStub
getParameter
public java.lang.String getParameter(java.lang.String name)
- Description copied from interface:
java.applet.AppletStub
- Returns the value of the specified parameter that was specified in
the
<APPLET> tag for this applet.
- Specified by:
getParameter in interface java.applet.AppletStub
appletResize
public void appletResize(int width,
int height)
- Description copied from interface:
java.applet.AppletStub
- Requests that the applet window for this applet be resized.
- Specified by:
appletResize in interface java.applet.AppletStub
getAppletContext
public java.applet.AppletContext getAppletContext()
- Description copied from interface:
java.applet.AppletStub
- Returns the applet context for this applet.
- Specified by:
getAppletContext in interface java.applet.AppletStub
getAudioClip
public java.applet.AudioClip getAudioClip(java.net.URL url)
- Description copied from interface:
java.applet.AppletContext
- Returns an audio clip from the specified URL.
- Specified by:
getAudioClip in interface java.applet.AppletContext
getImage
public java.awt.Image getImage(java.net.URL url)
- Description copied from interface:
java.applet.AppletContext
- Returns an image from the specified URL. Note that the image is not
actually retrieved until the applet attempts to display it, so this
method returns immediately.
- Specified by:
getImage in interface java.applet.AppletContext
getApplet
public java.applet.Applet getApplet(java.lang.String name)
- Description copied from interface:
java.applet.AppletContext
- Returns the applet in the document for this object that has the
specified name.
- Specified by:
getApplet in interface java.applet.AppletContext
getApplets
public java.util.Enumeration getApplets()
- Description copied from interface:
java.applet.AppletContext
- Returns a list of all the applets in the document for this object.
- Specified by:
getApplets in interface java.applet.AppletContext
showDocument
public void showDocument(java.net.URL url)
- Description copied from interface:
java.applet.AppletContext
- Displays the web page pointed to by the specified URL in the window
for this object. This page replaces the document that is currently
there.
- Specified by:
showDocument in interface java.applet.AppletContext
showDocument
public void showDocument(java.net.URL url,
java.lang.String target)
- Description copied from interface:
java.applet.AppletContext
- Displays the web page pointed to be the sepcified URL in the window
with the specified name. The standard names "_top", "_blank",
"_parent", and "_self" are allowed. An applet viewer may disregard
this request.
- Specified by:
showDocument in interface java.applet.AppletContext
showStatus
public void showStatus(java.lang.String status)
- Description copied from interface:
java.applet.AppletContext
- Displays the specified message in the status window if that window
exists.
- Specified by:
showStatus in interface java.applet.AppletContext
main
public static void main(java.lang.String[] args)
- Main program, usage: java riso.general.MainFrame applet-class-name [applet-args...].
Added by Robert Dodier.
Example: java riso.general.MainFrame riso.render.PlotDistribution height=400 width=400.