KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > applet > Applet

java.applet
Class Applet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
JApplet
See Also:
Top Examples, Source Code

public Applet()
       throws HeadlessException
See Also:
GraphicsEnvironment.isHeadless()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[972]Applet behaviour in different browsers
By Anonymous on 2004/10/01 14:51:06  Rate
Applet behaviour in different browsers 
 ======================================= 
  
  
 In Netscape 4, applets keep running until they fall off the history list. It is possible to have multiple instances of the same applet if the same web page is displayed in different windows or occurs multiple times in a history list.  
 In IE, applets are destroyed as soon as the page they are on is no longer viewed. When opening the same page in multiple windows, the windows are just different views upon the same applets.  
  
  
 The above behaviour has not been tested with HotJava. HotJava is different from the other browsers, though, in a different way. The applets in different frames or pages cannot access each other. In the other browsers, it was possible to know all the applets in the browser by having them communicate through static variables. In HotJava, it appears that each page is loaded by a different classloader.  
 


[1309]Access JavaScript methods, properties, and data structures from Java applet
By Anonymous on 2005/04/13 12:04:37  Rate
//To access JavaScript methods, properties, and data structures from 
 //Java applet, we need to import the Netscape javascript package: 
  
  
 import java.applet.Applet; 
 import java.awt.Event; 
 import java.awt.Graphics; 
 import netscape.javascript.*; 
  
  
 public class HelloWorld extends Applet  {  
     private String msg = "Hello World!"; 
      
     public void init (  )   {  
         try  {  
             JSObject win = JSObject.getWindow ( this ) ; 
             try  {  
                 msg =  ( String ) win.eval ( "document.testForm.message.value" ) ; 
              }  catch  ( Exception e1 )   {  
                 showStatus (  "Error call javascript err=" + e1  ) ; 
              }  
          }  catch  ( JSException e )   {  
             showStatus (  "Error call javascript err=" + e  ) ; 
          }  
      }  
      
     public void paint ( Graphics g )   {  
         g.drawString ( msg, 20, 20 ) ; 
         try  {  
             JSObject.getWindow ( this ) .call ( "showAlert", new Object [  ]  { "Hello Message From Applet" }  ) ; 
          }  catch  ( JSException e )   {  
             showStatus (  "Error call javascript err=" + e  ) ; 
          }  
      }  
      
     public void setMessage ( String msg )   {  
         this.msg = msg; 
         repaint (  ) ; 
      }  
      
     public boolean mouseMove ( Event e, int x, int y )   {  
         try   {  
          JSObject.getWindow  ( this ) .eval  ( "javascript:window.status='x:" + x + ", y:" + y + "'" )  ;  
       }  catch   ( Exception ex )   {              
          showStatus (  "Error call javascript err=" + ex  ) ; 
       }  
      return true ; 
      }  
  }  
   
  
  
 


[1750]Comments and request for Java, Java/Sun, misc credits,informally but valid
By bjbmpmn31 { at } lycos { dot } com on 2006/05/02 15:16:04  Rate
Hello there, 
  
  
 My name is Brett Bellomo, I have some comments to log for my goal 
 of electronic credit,--- 
 response 1.Java commands appear orderly and mathematically stable, 
 response 2.The commands do not appear overbearing for a running program 
 response 3.The commands touch on the idea of dissecting a program,but 
 basically do not. 
 response 4.The brackets add to the stability of the virtual program. 
 response 5.the commands assume java is running on the computer 
 response 6.The commands are similar to dos "top level commands, 
 and more importantly commands that carry different functions of 
 dos,they are not similar to complex entries that may be feasible, 
 for example, a scandisk entry at a dos prompt with extra commands. 
 request:for virtual electronic credit, may access my e-resume 
 referring in part to java from Sun Microsystems, i.d. 
 Brett Bellomo,Mtka,Minnesota,apt 223,5101 hwy 7,zip 55345 
 bday 7,22,75,ssc 476, bcbs y.... permission given with i.d.s. 
 Permission to give electronic credit for Java aptitude. 
  
  
 


public void destroy()
See Also:
stop(), start(), init()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AccessibleContext getAccessibleContext()
See Also:
Panel, Accessible
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AppletContext getAppletContext()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1872]Error finding API...too deeply nested.API.LMSGetvalue0 was not successful
By syamsani { at } yahoo { dot } com Dr Yamsani Srinivas on 2007/04/10 08:44:28  Rate
my comp is in vista Hopme premium.Actually I haveinstalled my disc and i want to open it to read.But the following information is coming on my computers.Error finding API...too deeply nested.API.LMSGetvalue0 was not successful

public String getAppletInfo()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AudioClip getAudioClip(URL url)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AudioClip getAudioClip(URL url,
                              String name)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1990]HOW SUPPORT JAVA AUDIO CLIPS
By YOGESH KUSHWAHA on 2009/03/24 01:41:45  Rate
public void play ( URL url )   {  
   AudioClip clip = getAudioClip ( url ) ; 
   if  ( clip != null )   {  
     clip.play (  ) ; 
    }  
  }  
 


public URL getCodeBase()
See Also:
getDocumentBase()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public URL getDocumentBase()
See Also:
getCodeBase()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Image getImage(URL url)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Image getImage(URL url,
                      String name)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Locale getLocale()
See Also:
Component.setLocale(java.util.Locale)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getParameter(String name)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String[][] getParameterInfo()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void init()
See Also:
stop(), start(), destroy()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isActive()
See Also:
stop(), start()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final AudioClip newAudioClip(URL url)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void play(URL url)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void play(URL url,
                 String name)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void resize(int width,
                   int height)
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void resize(Dimension d)
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final void setStub(AppletStub stub)
See Also:
SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void showStatus(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void start()
See Also:
ComponentListener.componentShown(java.awt.event.ComponentEvent), Component.isShowing(), stop(), init(), destroy()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void stop()
See Also:
init(), destroy()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1844]Simple "Hello World" applet
By Anonymous on 2006/11/15 14:27:34  Rate
// Hello.java 
 import java.applet.Applet; 
 import java.awt.Graphics; 
  
  
 public class Hello extends Applet  {  
    public void paint ( Graphics gc )   {  
       gc.drawString ( "Hello, world!", 65, 95 ) ; 
     }      
  } 

Popular Tags