WDD_lec_20 - Applets Lec - 20 Umair Javed Applets An applet...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Umair Javed© Applets Lec - 20
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Umair Javed © Applets An applet is a Panel that allows interaction with a Java program A applet is typically embedded in a Web page and can be run from a browser You need special HTML in the Web page to tell the browser about the applet For security reasons, applets run in a sandbox : they have no access to the client’s file system
Background image of page 2
3 Umair Javed © Applet Support Most modern browsers support Java 1.4 if they have the appropriate plugin Sun provides an application appletviewer to view applets without using browser. In general you should try to write applets that can be run with any browser
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Umair Javed © What an applet is You write an applet by extending the class Applet or  JApplet Applet is just a class like any other; you can even use it in applications if you want When you write an applet, you are only writing part of a program The browser supplies the main method
Background image of page 4
5 Umair Javed © The genealogy of Applet java.lang.Object    |    +----java.awt.Component            |            +----java.awt.Container                    |                    +----java.awt.Panel                            |                            +----java.applet.Applet                              +----javax.swing.JApplet
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Umair Javed© Code Example
Background image of page 6
7 Umair Javed © A simple applet import java.awt.*; import javax.swing.JApplet; public class HelloApplet extends JApplet {     public void paint( Graphics g ) {         g.drawString( "Hello World!", 30, 30 );     } } HelloApplet.java
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Umair Javed © Structure of an HTML page HTML TITLE BODY HEAD (content) Most HTML tags are containers. A container is
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/01/2010 for the course CS CS506 taught by Professor mr. umair javed during the Spring '10 term at Virtual University of Pakistan.

Page1 / 30

WDD_lec_20 - Applets Lec - 20 Umair Javed Applets An applet...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online