Class AppletApplication

  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 m42.jnlpapplet.AppletApplication
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, javax.accessibility.Accessible, javax.swing.RootPaneContainer
Direct Known Subclasses:

public abstract class AppletApplication
extends javax.swing.JApplet
implements java.lang.Runnable

AppletApplication is an abstract base class for applets that can also function as applications. The AppletApplication class provides abstract methods (primarily

See Also:
createGUI(java.awt.Container), startGUI(), getWindowTitle(), JNLPAppletApplication, Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JApplet
Nested classes/interfaces inherited from class java.applet.Applet
Nested classes/interfaces inherited from class java.awt.Panel
Nested classes/interfaces inherited from class java.awt.Container
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
Field Summary
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
Method Summary
protected abstract  void createGUI(java.awt.Container container)
          Create the GUI components of the application.
protected abstract  java.lang.String getWindowTitle()
          Return the window title.
 void init()
          Initializes an applet.
 boolean isApplet()
          Allows a caller to check if this code is running within an applet.
static void main(java.lang.String[] args)
          Sample applet cum application.
 void run()
          Runs an applet.
 void startGUI()
          Starts the graphical user of interface of the applet/application.
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
Methods inherited from class java.awt.Panel
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, 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, 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, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public AppletApplication()
Method Detail


protected abstract java.lang.String getWindowTitle()
Return the window title. This method should be implemented by sub-classes to return the window title.

The window title.


protected abstract void createGUI(java.awt.Container container)
Create the GUI components of the application. This methd should be implemented by sub-classes to create the user interface of the application. It is invoked within the UI thread of the applet or application. All UI elements should be added to the UI container. The main method of this class contains an example of an implementation.

container - The user interface container.
See Also:


public boolean isApplet()
Allows a caller to check if this code is running within an applet.

true if the code is running in an applet, false otherwise.


public void startGUI()
Starts the graphical user of interface of the applet/application. This should be called from within the main method of an application class that derives from AppletApplication. It also is called from within the init() method of this class, so there is no need to invoke it directly, if the init() method is being overriden. It is sufficient to invoke the init method. There is usually no necessity to override this method.

See Also:
AppletApplication, init()


public void run()
Runs an applet. This method overrides the run method of JApplet. It invokes createGUI to allow the application to ceeate the components of the application's user interface. There is usually no necessity to override this method.

Specified by:
run in interface java.lang.Runnable


public void init()
Initializes an applet. This method overrides the init() method of JApplet to setup the container and start the UI thread where all GUI components are created. init() is only called when the code is run as an applet. It therefore sets a flag indicating this. The flag can retrieved using the isApplet() method. There is usually no necessity to override this method.

init in class java.applet.Applet
See Also:


public static void main(java.lang.String[] args)
Sample applet cum application. This main function demonstrates how the AppletApplication class can be used to create Java application that is also an applet. It creates an anonymous sub-class of AppletApplication and invokes the startGUI method of the object. The anonymous sub-class implements two methods: getWindowTitle() to return the title of the application window. and createGUI() that creates the application's UI: in this case, a label showing the text 'Applet cum Application'.