Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Applets CS 3505 Client Side Scripting with applets.

Similar presentations


Presentation on theme: "Introduction to Applets CS 3505 Client Side Scripting with applets."— Presentation transcript:

1 Introduction to Applets CS 3505 Client Side Scripting with applets

2 Applets Applet means “small application” written in Java Applets are executed on the client side meaning the Browser is interpreting the Java code The Java Code is downloaded with the HTML page Client Browser must be Java-enabled Learn a some basics Ref: Greenlaw ch 12.3 Learn to Get scripts from Web and insert Tutorial at http://www.acuteapplets.com/Tutorial.shtml Free Applets http://javaboutique.internet.com/

3 Applets Architecture? Client side Dynamic content download to client Html file html Java code Execute html Calls Applet Download the java code Execute html Java Interpreter java class file

4 Simple Applet Example <APPLET CODE="urname.class” WIDTH="250" HEIGHT="22"> Start tag Location of Java code Attributes End tag HTML document contains a reference call to an applet Execute Urname.html Urname.class

5 Syntax and Notation Write a java applet and save as a class file Example.class - contains java code and all interfaces create. destroy Using an Applet in HTML – - start tag –<PARAM name=“input” -input variable value=“ content -input list ”>-end input variable – warning display - for not applet enabled browsers – - end tag See AppletAcuteShifter,html for parameter examples

6 Some Attributes CODE = “Filename” - Specifies filename (.class)of the java applet code relative to the Web page HEIGHT = “Pixels” - height in pixels WIDTH = “Pixels” - width in pixels Required Attributes: Other Attributes: NAME = “name” - name by which the applet is called when manipulated by other web page elements. These are usually java script function calls. CODEBASE =“URL” - base location relative to which the java file is located.

7 Applet Control * Once Applets are identified with the NAME attribute * They can then be manipulated using JavaScript functions Example: document.appletname.loadMain('New message text', ‘style.txt'); Executes an applet named “appletname”. This applet parses the words 'New message text‘ to direct the Generation of HTML output and reads style instructions from an external file ‘style.txt’

8 Get Applets from the Web Java Applets are relatively hard to write and harder to debug Many Applets are available free on the web Search for Applets source on your favorite search engine –Try http://www.AcuteApplets.com/ –I got AppletAcuteShifter Applets code is NOT viewable so you need a cooperative site that allows downloading In most cases some editing is required –Need to know enough HTML and Applet tag attributes to do this


Download ppt "Introduction to Applets CS 3505 Client Side Scripting with applets."

Similar presentations


Ads by Google