What are Applets ?

129

An applet is a Java program that can be embedded in a web page. Java applications are run by using a Java interpreter. Applets are run one any browser that supports Java. Applets can also be tested using the appletviewer tool include in the Java Development Kit. in order to run an applet it must be include in a web page, using HTML tags. When a user browsers a web server and runs it on the users system. Applets certain restriction put ion them.

  • They can not read or write files on the users’s system.
  • They can not load or run any programs stored on the user’s system.

All applets are subclasses of the applet class in the java.applet package. Applets do not have main () method. All applets must be declared public. An applet displays information on the screen by using the paint method. This method is available in java.wat.Component class. This method takes an instance of Graphics class and passes to the method paint (). Graphics class provides a method drawString to display text. It also requires position to be specified as arguments.




Leave a Reply

Your email address will not be published. Required fields are marked *