CS2_41_Applets

CS2_41_Applets - CS2 Module 41 Category: Elements of Java...

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

View Full Document Right Arrow Icon
CS2 Module 41 Category: Elements of Java Topic: Applets Objectives Applets vs. Applications Applet/Browswer Cautions Examples Example of Converting a console GUI to an Applet
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 2 Introduction to Object Oriented Programming Module 41 Elements of Java Applets
Background image of page 2
Why Care about Applets? Enable us to run java code embedded in a web page Java is ideal since it is platform independent And we have no idea nor do we want to care what platform a web surfer might be using Allow use to make more powerful web pages Allow us to “serve” a program to a user, but have them run it locally on their machine Takes a major burden off us – the “server” – we simply serve (ie. transfer the file) the bytecode Puts onus on user – the “client” - to supply computing power to run the java code (imagine perhaps a game someone would want to run for hours….) YOUR RESUME!
Background image of page 3

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

View Full DocumentRight Arrow Icon
The Bad News Current releases of Java are incompatible with most browsers To use applets you have two choices Write applets in older versions of Java Download a plug-in which will update YOUR browser Plug-in available at: http://java.sun.com/getjava/download.html
Background image of page 4
Limitations of Applets – Why? Applets are loaded from a remote site (web server, ex. ESPN web server) Applets are designed to execute on a client’s machine (ex. on a web surfer – John Q. Public’s Sony laptop running Windows 2000) Security and trust are vital Certain restrictions apply Applets run inside a “sandbox” Applet security manager protects the user
Background image of page 5

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

View Full DocumentRight Arrow Icon
Cannot be used to spy on the client’s machine (with minor exceptions) Cannot alter a user’s system Can show images Can play sounds Can get input from the user – mouseclicks, keystrokes Can send user input back to the host if desired Can perform sophisticated calculations (don’t let the app-”let” name fool you)
Background image of page 6
More Applet Restriction Details Can never run any client executable Cannot communicate with any host other than the server from which it came, “originating host” Cannot read or write to the client’s file system Can find out only limited info about the client machine: Java version in use Name and version of OS running Characters used as file and line separators Client currency (US dollar) Windows popped up by an applet carry a warning msg
Background image of page 7

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

View Full DocumentRight Arrow Icon
Security Summary Code is interpreted by the JVM and not executed directly The security manager checks sensitive operations in the Java run-time library Applets can contain a signature to identify their origin
Background image of page 8
Applet Creation Use Swing – extend the class javax.swing.JApplet Use the AWT – extend the class java.awt.Applet We will focus on the newer library, Swing, and it’s applet class, JApplet Just as we have seen with a JFrame, if we attach
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 42

CS2_41_Applets - CS2 Module 41 Category: Elements of Java...

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

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