15
Java Applet Presented by: Feng Liu

Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Embed Size (px)

Citation preview

Page 1: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Java Applet

Presented by: Feng Liu

Page 2: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

AgendaAgenda

• Introduction

• Java Applet vs. JavaScript

• Steps in Creating a Java Applet

• Java Applet Example

• Do I have to write my own

• Summary

Page 3: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

IntroductionIntroduction

• What is JAVA?

Java is an object oriented programming language created

by Sun Microsystems

• What is Java Applet? A fully functioning small Java application

Used for Web Design

Need to be embedded into HTML file

Page 4: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

IntroductionIntroduction

• What Java Applet Can do? Display message and image on a web page

Draw picture on a web page

receive input from the user through keyboard or mouse

Play Sound

Page 5: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Java Applet vs. JavaScriptJava Applet vs. JavaScript

• Both similar and quite different

Java Applet JavaScript

Created by Sun Created by Netscape

Standalone application

Developed outside out of HTML

text that is fed into a browser that can read it and then is enacted by the browser.

Must be converted into machine language before it can be run on the web

Text based, not need to be compiled

Once it is compiled, it is set. Have to go back to the original text and

alter it, then compile again.

Can be altered after it runs and run it again and again

Page 6: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Steps in Creating a Java AppletSteps in Creating a Java Applet

• Write the Java Applet Source Code import java.applet.Applet; import java.awt.Graphics; public class HelloWorldApplet extends Applet { public void paint(Graphics g) { g.drawString("Hello world!", 50, 25); }

}

• compile it

Page 7: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write
Page 8: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Steps in Creating a Java AppletSteps in Creating a Java Applet

• Write a HTML to call the Applet <html>

……. <applet CODE=“HelloWorldApplet.class" WIDTH="250"

HEIGHT="22"> </applet> …… </html>

• Open the HTML file in browser and run it

Page 9: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write
Page 10: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Java Applet ExampleJava Applet Example

Page 11: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Java Applet ExampleJava Applet Example

Page 12: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Do I have to write my ownDo I have to write my own

• No!

• There are many Java Applet available on the Web

• For Example: Java Boutique http://javaboutique.internet.com/

Java File http://www.javafile.com/

Freeware Java http://www.freewarejava.com/applets/index.shtml

etc.

Page 13: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

SummarySummary

• Java Applet is part of Java Programming language

• It is a useful tool for the Web Development

• There are thousands of Java Applet available online

• If you decide to use those free applets, make sure you give the author credits

Page 14: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

ReferencesReferences

• HTML HOODIES. (2003). So, You Want A Java Applet, Huh!?.http://www.htmlgoodies.com/beyond/applet.html

• HTML HOODIES. (2003). Java vs. JavaScript.http://www.htmlgoodies.com/beyond/j_vs_js.html

• Smith, D. (1998). Java for the world wide web. California: Peachpit Press

• What can a Java Applet do?http://www.vovisoft.com/java/JavaLecture/Week05/12%20What%20can

%20a%20Java%20Applet%20do.html

Page 15: Java Applet Presented by: Feng Liu. Agenda Introduction Java Applet vs. JavaScript Steps in Creating a Java Applet Java Applet Example Do I have to write

Thank you

Any Question?