Example #1
0
  /** Reload the applet. */
  void appletReload() {
    panel.sendEvent(AppletPanel.APPLET_STOP);
    panel.sendEvent(AppletPanel.APPLET_DESTROY);
    panel.sendEvent(AppletPanel.APPLET_DISPOSE);

    /**
     * Fixed #4501142: Classlaoder sharing policy doesn't take "archive" into account. This will be
     * overridden by Java Plug-in. [stanleyh]
     */
    AppletPanel.flushClassLoader(panel.getClassLoaderCacheKey());

    /*
     * Make sure we don't have two threads running through the event queue
     * at the same time.
     */
    try {
      panel.joinAppletThread();
      panel.release();
    } catch (InterruptedException e) {
      return; // abort the reload
    }

    panel.createAppletThread();
    panel.sendEvent(AppletPanel.APPLET_LOAD);
    panel.sendEvent(AppletPanel.APPLET_INIT);
    panel.sendEvent(AppletPanel.APPLET_START);
  }
Example #2
0
  /**
   * Send the initial set of events to the appletviewer event queue. On start-up the current
   * behaviour is to load the applet and call Applet.init() and Applet.start().
   */
  private void initEventQueue() {
    // appletviewer.send.event is an undocumented and unsupported system
    // property which is used exclusively for testing purposes.
    String eventList = System.getProperty("appletviewer.send.event");

    if (eventList == null) {
      // Add the standard events onto the event queue.
      panel.sendEvent(AppletPanel.APPLET_LOAD);
      panel.sendEvent(AppletPanel.APPLET_INIT);
      panel.sendEvent(AppletPanel.APPLET_START);
    } else {
      // We're testing AppletViewer.  Force the specified set of events
      // onto the event queue, wait for the events to be processed, and
      // exit.

      // The list of events that will be executed is provided as a
      // ","-separated list.  No error-checking will be done on the list.
      String[] events = splitSeparator(",", eventList);

      for (int i = 0; i < events.length; i++) {
        System.out.println("Adding event to queue: " + events[i]);
        if (events[i].equals("dispose")) panel.sendEvent(AppletPanel.APPLET_DISPOSE);
        else if (events[i].equals("load")) panel.sendEvent(AppletPanel.APPLET_LOAD);
        else if (events[i].equals("init")) panel.sendEvent(AppletPanel.APPLET_INIT);
        else if (events[i].equals("start")) panel.sendEvent(AppletPanel.APPLET_START);
        else if (events[i].equals("stop")) panel.sendEvent(AppletPanel.APPLET_STOP);
        else if (events[i].equals("destroy")) panel.sendEvent(AppletPanel.APPLET_DESTROY);
        else if (events[i].equals("quit")) panel.sendEvent(AppletPanel.APPLET_QUIT);
        else if (events[i].equals("error")) panel.sendEvent(AppletPanel.APPLET_ERROR);
        else
          // non-fatal error if we get an unrecognized event
          System.out.println("Unrecognized event name: " + events[i]);
      }

      while (!panel.emptyEventQueue()) ;
      appletSystemExit();
    }
  }
Example #3
0
 /** Stop the applet. */
 void appletStop() {
   panel.sendEvent(AppletPanel.APPLET_STOP);
 }
Example #4
0
 /** Start the applet. */
 void appletStart() {
   panel.sendEvent(AppletPanel.APPLET_START);
 }
Example #5
0
 /** Restart the applet. */
 void appletRestart() {
   panel.sendEvent(AppletPanel.APPLET_STOP);
   panel.sendEvent(AppletPanel.APPLET_DESTROY);
   panel.sendEvent(AppletPanel.APPLET_INIT);
   panel.sendEvent(AppletPanel.APPLET_START);
 }