home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / afc11 / JNotepad / src / JNoteAppletObject.java < prev    next >
Encoding:
Java Source  |  2000-05-04  |  1.3 KB  |  57 lines

  1. //
  2. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  3. //
  4. import com.ms.ui.*;
  5.  
  6. /**
  7. *    This object holds a static copy of the UIApplet in this system.
  8. *    This is used by classes which need to have access to the UIApplet object
  9. *    deep down in the hierarchy, mainly for compatibility with the different
  10. *    security model applets use. This is set once, in the JNotePadFrame class,
  11. *    and grabbed everywhere else.
  12. *
  13. *    @see    JNotePadFrame
  14. *
  15. *    @version    1.0, 8/22/97
  16. */
  17.  
  18. public class JNoteAppletObject 
  19. {
  20.     /**
  21.     *    The UIApplet the application is running in. null if running as standalone
  22.     */
  23.     private static UIApplet theApplet;
  24.     
  25.     /**
  26.     *    Sets the application-wide UIApplet object. 
  27.     *    
  28.     *    @param    applet    The applet we are running in. null if we're a standalone app
  29.     */
  30.     public static void setApplet(UIApplet applet)
  31.     {
  32.         theApplet = applet;            
  33.     }
  34.     
  35.     /**
  36.     *    Determines whether we're running in an applet or not.    
  37.     *    
  38.     *    @returns    true if we're running as an applet, false if we're running standalone.
  39.     */
  40.     public static boolean isApplet()
  41.     {
  42.         return (theApplet != null);
  43.     }
  44.     
  45.     /**
  46.     *    Retrieves the applet object    
  47.     *    
  48.     *    @returns    The applet we're running in. Returns null if we're running standalone.
  49.     */
  50.     public static UIApplet getApplet()
  51.     {
  52.         return theApplet;
  53.     }
  54.     
  55. }
  56.  
  57.