Save This Page
Home » openjdk-7 » sun » applet » [javadoc | source]
sun.applet
abstract public class: AppletPanel [javadoc | source]
java.lang.Object
   java.awt.Component
      java.awt.Container
         java.awt.Panel
            sun.applet.AppletPanel

All Implemented Interfaces:
    AppletStub, Runnable, Accessible, MenuContainer, ImageObserver, Serializable

Direct Known Subclasses:
    AppletViewerPanel

Applet panel class. The panel manages and manipulates the applet as it is being loaded. It forks a separate thread in a new thread group to call the applet's init(), start(), stop(), and destroy() methods.
Field Summary
 Applet applet    The applet (if loaded). 
protected  boolean doInit    Applet will allow initialization. Should be set to false if loading a serialized applet that was pickled in the init=true state. 
 AppletClassLoader loader    The classloader for the applet. 
public static final  int APPLET_DISPOSE     
public static final  int APPLET_LOAD     
public static final  int APPLET_INIT     
public static final  int APPLET_START     
public static final  int APPLET_STOP     
public static final  int APPLET_DESTROY     
public static final  int APPLET_QUIT     
public static final  int APPLET_ERROR     
public static final  int APPLET_RESIZE     
public static final  int APPLET_LOADING     
public static final  int APPLET_LOADING_COMPLETED     
protected  int status    The current status. One of: APPLET_DISPOSE, APPLET_LOAD, APPLET_INIT, APPLET_START, APPLET_STOP, APPLET_DESTROY, APPLET_ERROR. 
 Thread handler    The thread for the applet. 
 Dimension defaultAppletSize    The initial applet size. 
 Dimension currentAppletSize    The current applet size. 
 MessageUtils mu     
 Thread loaderThread    The thread to use during applet loading 
 boolean loadAbortRequest    Flag to indicate that a loading has been cancelled 
Fields inherited from java.awt.Component:
TOP_ALIGNMENT,  CENTER_ALIGNMENT,  BOTTOM_ALIGNMENT,  LEFT_ALIGNMENT,  RIGHT_ALIGNMENT
Method from sun.applet.AppletPanel Summary:
addAppletListener,   appletResize,   changeFrameAppContext,   clearLoadAbortRequest,   createApplet,   createAppletThread,   createClassLoader,   dispatchAppletEvent,   emptyEventQueue,   flushClassLoader,   flushClassLoaders,   getApplet,   getAppletHandlerThread,   getAppletHeight,   getAppletWidth,   getClassLoader,   getClassLoaderCacheKey,   getCode,   getHeight,   getJarFiles,   getNextEvent,   getSerializedObject,   getWidth,   hasInitialFocus,   init,   isActive,   isJDK11Applet,   isJDK12Applet,   joinAppletThread,   loadJarFiles,   minimumSize,   okToLoad,   preferredSize,   release,   removeAppletListener,   run,   sendEvent,   setBounds,   setLoadAbortRequest,   setupAppletAppContext,   showAppletException,   showAppletLog,   showAppletLog,   showAppletStatus,   showAppletStatus,   showAppletStatus,   stopLoading
Methods from java.awt.Panel:
addNotify,   getAccessibleContext
Methods from java.awt.Container:
add,   add,   add,   add,   add,   addContainerListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   applyComponentOrientation,   areFocusTraversalKeysSet,   countComponents,   deliverEvent,   doLayout,   findComponentAt,   findComponentAt,   getAlignmentX,   getAlignmentY,   getComponent,   getComponentAt,   getComponentAt,   getComponentCount,   getComponentZOrder,   getComponents,   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,   remove,   remove,   removeAll,   removeContainerListener,   removeNotify,   setComponentZOrder,   setFocusCycleRoot,   setFocusTraversalKeys,   setFocusTraversalPolicy,   setFocusTraversalPolicyProvider,   setFont,   setLayout,   transferFocusBackward,   transferFocusDownCycle,   update,   validate
Methods from java.awt.Component:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   applyComponentOrientation,   areFocusTraversalKeysSet,   bounds,   checkImage,   checkImage,   contains,   contains,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   dispatchEvent,   doLayout,   enable,   enable,   enableInputMethods,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   getAccessibleContext,   getAlignmentX,   getAlignmentY,   getBackground,   getBaseline,   getBaselineResizeBehavior,   getBounds,   getBounds,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getCursor,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFont,   getFontMetrics,   getForeground,   getGraphics,   getGraphicsConfiguration,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMousePosition,   getMouseWheelListeners,   getName,   getParent,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSize,   getSize,   getToolkit,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   inside,   invalidate,   isBackgroundSet,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusable,   isFontSet,   isForegroundSet,   isLightweight,   isMaximumSizeSet,   isMinimumSizeSet,   isOpaque,   isPreferredSizeSet,   isShowing,   isValid,   isVisible,   keyDown,   keyUp,   layout,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   paint,   paintAll,   postEvent,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocusInWindow,   reshape,   resize,   resize,   setBackground,   setBounds,   setBounds,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusable,   setFont,   setForeground,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setMaximumSize,   setMinimumSize,   setName,   setPreferredSize,   setSize,   setSize,   setVisible,   show,   show,   size,   toString,   transferFocus,   transferFocusBackward,   transferFocusUpCycle,   update,   validate
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.applet.AppletPanel Detail:
 public synchronized  void addAppletListener(AppletListener l) 
 public  void appletResize(int width,
    int height) 
    Is called when the applet wants to be resized.
 public static  void changeFrameAppContext(Frame frame,
    AppContext newAppContext) 
 protected synchronized  void clearLoadAbortRequest() 
 protected Applet createApplet(AppletClassLoader loader) throws IOException, ClassNotFoundException, InterruptedException, InstantiationException, IllegalAccessException 
 synchronized  void createAppletThread() 
 protected AppletClassLoader createClassLoader(URL codebase) 
    This method actually creates an AppletClassLoader. It can be override by subclasses (such as the Plug-in) to provide different classloaders.
 public  void dispatchAppletEvent(int id,
    Object argument) 
    Dispatch event to the listeners..
 boolean emptyEventQueue() 
 public static synchronized  void flushClassLoader(String key) 
    Flush a class loader.
 public static synchronized  void flushClassLoaders() 
    Flush all class loaders.
 public Applet getApplet() 
 public Thread getAppletHandlerThread() 
 public int getAppletHeight() 
 public int getAppletWidth() 
 synchronized AppletClassLoader getClassLoader(URL codebase,
    String key) 
    Get a class loader. Create in a restricted context
 public String getClassLoaderCacheKey() 
    Get caching key for classloader cache
 abstract protected String getCode()
 abstract public int getHeight()
 abstract protected String getJarFiles()
 synchronized AppletEvent getNextEvent() throws InterruptedException 
    Get an event from the queue.
 abstract protected String getSerializedObject()
 abstract public int getWidth()
 abstract public boolean hasInitialFocus()
 public  void init() 
    Construct an applet viewer and start the applet.
 public boolean isActive() 
    Return true when the applet has been started.
 protected boolean isJDK11Applet() 
    Return true if applet is targeted to JDK 1.1.
 protected boolean isJDK12Applet() 
    Return true if applet is targeted to JDK1.2.
  void joinAppletThread() throws InterruptedException 
 protected  void loadJarFiles(AppletClassLoader loader) throws IOException, InterruptedException 
 public Dimension minimumSize() 
    Minimum size
 protected synchronized boolean okToLoad() 
 public Dimension preferredSize() 
    Preferred size
  void release() 
 public synchronized  void removeAppletListener(AppletListener l) 
 public  void run() 
    Execute applet events. Here is the state transition diagram Note: (XXX) is the action APPLET_XXX is the state (applet code loaded) --> APPLET_LOAD -- (applet init called)--> APPLET_INIT -- ( applet start called) --> APPLET_START -- (applet stop called) -->APPLET_STOP --(applet destroyed called) --> APPLET_DESTROY -->(applet gets disposed) --> APPLET_DISPOSE -->.... In the legacy lifecycle model. The applet gets loaded, inited and started. So it stays in the APPLET_START state unless the applet goes away(refresh page or leave the page). So the applet stop method called and the applet enters APPLET_STOP state. Then if the applet is revisited, it will call applet start method and enter the APPLET_START state and stay there. In the modern lifecycle model. When the applet first time visited, it is same as legacy lifecycle model. However, when the applet page goes away. It calls applet stop method and enters APPLET_STOP state and then applet destroyed method gets called and enters APPLET_DESTROY state. This code is also called by AppletViewer. In AppletViewer "Restart" menu, the applet is jump from APPLET_STOP to APPLET_DESTROY and to APPLET_INIT . Also, the applet can jump from APPLET_INIT state to APPLET_DESTROY (in Netscape/Mozilla case). Same as APPLET_LOAD to APPLET_DISPOSE since all of this are triggered by browser.
 public  void sendEvent(int id) 
    Send an event. Queue it for execution by the handler thread.
 public  void setBounds(int x,
    int y,
    int width,
    int height) 
 protected synchronized  void setLoadAbortRequest() 
 protected  void setupAppletAppContext() 
 protected  void showAppletException(Throwable t) 
    Called by the AppletPanel to provide feedback when an exception has happened.
 protected  void showAppletLog(String msg) 
    Called by the AppletPanel to print to the log.
 protected  void showAppletLog(String msg,
    Object arg) 
 protected  void showAppletStatus(String status) 
    Status line. Called by the AppletPanel to provide feedback on the Applet's state.
 protected  void showAppletStatus(String status,
    Object arg) 
 protected  void showAppletStatus(String status,
    Object arg1,
    Object arg2) 
 protected synchronized  void stopLoading() 
    Request that the loading of the applet be stopped.