{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

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

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right Arrow Icon
Umair Javed© Code Example
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
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern