< prev index next >

src/java.desktop/share/classes/sun/applet/AppletPanel.java

Print this page




 217             currentAppletSize.height = defaultAppletSize.height;
 218 
 219         } catch (NumberFormatException e) {
 220             // Turn on the error flag and let TagAppletPanel
 221             // do the right thing.
 222             status = APPLET_ERROR;
 223             showAppletStatus("badattribute.exception");
 224             showAppletLog("badattribute.exception");
 225             showAppletException(e);
 226         }
 227 
 228         setLayout(new BorderLayout());
 229 
 230         createAppletThread();
 231     }
 232 
 233     /**
 234      * Minimum size
 235      */
 236     @Override

 237     public Dimension minimumSize() {
 238         return new Dimension(defaultAppletSize.width,
 239                              defaultAppletSize.height);
 240     }
 241 
 242     /**
 243      * Preferred size
 244      */
 245     @Override

 246     public Dimension preferredSize() {
 247         return new Dimension(currentAppletSize.width,
 248                              currentAppletSize.height);
 249     }
 250 
 251     private AppletListener listeners;
 252 
 253     /**
 254      * AppletEvent Queue
 255      */
 256     private Queue<Integer> queue = null;
 257 
 258 
 259     synchronized public void addAppletListener(AppletListener l) {
 260         listeners = AppletEventMulticaster.add(listeners, l);
 261     }
 262 
 263     synchronized public void removeAppletListener(AppletListener l) {
 264         listeners = AppletEventMulticaster.remove(listeners, l);
 265     }


 683         }
 684 
 685         if (toFocus != null) {
 686             if (parent instanceof EmbeddedFrame) {
 687                 ((EmbeddedFrame)parent).synthesizeWindowActivation(true);
 688             }
 689             // EmbeddedFrame might have focus before the applet was added.
 690             // Thus after its activation the most recent focus owner will be
 691             // restored. We need the applet's initial focusabled component to
 692             // be focused here.
 693             toFocus.requestFocusInWindow();
 694         }
 695     }
 696 
 697     /**
 698      * Load the applet into memory.
 699      * Runs in a seperate (and interruptible) thread from the rest of the
 700      * applet event processing so that it can be gracefully interrupted from
 701      * things like HotJava.
 702      */

 703     private void runLoader() {
 704         if (status != APPLET_DISPOSE) {
 705             showAppletStatus("notdisposed");
 706             return;
 707         }
 708 
 709         dispatchAppletEvent(APPLET_LOADING, null);
 710 
 711         // REMIND -- might be cool to visually indicate loading here --
 712         // maybe do animation?
 713         status = APPLET_LOAD;
 714 
 715         // Create a class loader
 716         loader = getClassLoader(getCodeBase(), getClassLoaderCacheKey());
 717 
 718         // Load the archives if present.
 719         // REMIND - this probably should be done in a separate thread,
 720         // or at least the additional archives (epll).
 721 
 722         String code = getCode();




 217             currentAppletSize.height = defaultAppletSize.height;
 218 
 219         } catch (NumberFormatException e) {
 220             // Turn on the error flag and let TagAppletPanel
 221             // do the right thing.
 222             status = APPLET_ERROR;
 223             showAppletStatus("badattribute.exception");
 224             showAppletLog("badattribute.exception");
 225             showAppletException(e);
 226         }
 227 
 228         setLayout(new BorderLayout());
 229 
 230         createAppletThread();
 231     }
 232 
 233     /**
 234      * Minimum size
 235      */
 236     @Override
 237     @SuppressWarnings("deprecation")
 238     public Dimension minimumSize() {
 239         return new Dimension(defaultAppletSize.width,
 240                              defaultAppletSize.height);
 241     }
 242 
 243     /**
 244      * Preferred size
 245      */
 246     @Override
 247     @SuppressWarnings("deprecation")
 248     public Dimension preferredSize() {
 249         return new Dimension(currentAppletSize.width,
 250                              currentAppletSize.height);
 251     }
 252 
 253     private AppletListener listeners;
 254 
 255     /**
 256      * AppletEvent Queue
 257      */
 258     private Queue<Integer> queue = null;
 259 
 260 
 261     synchronized public void addAppletListener(AppletListener l) {
 262         listeners = AppletEventMulticaster.add(listeners, l);
 263     }
 264 
 265     synchronized public void removeAppletListener(AppletListener l) {
 266         listeners = AppletEventMulticaster.remove(listeners, l);
 267     }


 685         }
 686 
 687         if (toFocus != null) {
 688             if (parent instanceof EmbeddedFrame) {
 689                 ((EmbeddedFrame)parent).synthesizeWindowActivation(true);
 690             }
 691             // EmbeddedFrame might have focus before the applet was added.
 692             // Thus after its activation the most recent focus owner will be
 693             // restored. We need the applet's initial focusabled component to
 694             // be focused here.
 695             toFocus.requestFocusInWindow();
 696         }
 697     }
 698 
 699     /**
 700      * Load the applet into memory.
 701      * Runs in a seperate (and interruptible) thread from the rest of the
 702      * applet event processing so that it can be gracefully interrupted from
 703      * things like HotJava.
 704      */
 705     @SuppressWarnings("deprecation")
 706     private void runLoader() {
 707         if (status != APPLET_DISPOSE) {
 708             showAppletStatus("notdisposed");
 709             return;
 710         }
 711 
 712         dispatchAppletEvent(APPLET_LOADING, null);
 713 
 714         // REMIND -- might be cool to visually indicate loading here --
 715         // maybe do animation?
 716         status = APPLET_LOAD;
 717 
 718         // Create a class loader
 719         loader = getClassLoader(getCodeBase(), getClassLoaderCacheKey());
 720 
 721         // Load the archives if present.
 722         // REMIND - this probably should be done in a separate thread,
 723         // or at least the additional archives (epll).
 724 
 725         String code = getCode();


< prev index next >