advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

JavaBoutique: Articles: Tutorials:

Contents
Getting Started
Java Classes and Methods
The Code, Boss...the Code!
A Touch of Class
Packaging up your Code
Running a Java Application
Creating Java Applets
Embedding Applets in your HTML Pages
Adding Interaction
Conclusion

Java Programming
from the Grounds Up

by Mark C. Reynolds

With Java, it's possible to write some very sophisticated applets with a relatively small amount of code. Here's how.


Wildly popular due to its interactive multimedia capabilities, Java programming leads the list of Internet development skills in current commercial demand. In this first half of our two-part tutorial on Java applet development, we explore the essentials of Java's components. These include how Java development tools relate to each other and--most importantly--how they are used to provide content that executes on the client side instead of on your server.

Before Sun Microsystems introduced Java, most Web interactivity was accomplished via CGI (Common Gateway Interface) scripting. This is frequently utilized in forms or guestbooks where users type entries into text fields, then submit this information via their browser back to a host server. The host server then passes the information to an external program running on the Web server's machine. The output of this external program is then passed from the server back to the browser. CGIs must execute at least one round trip from the browser to the server and back.

In contrast, when a Java-compatible browser accesses a Java-powered page, an applet--a small program written in Java--is copied to the browser's machine and executes there. It does not execute on the server the way a CGI program does. This local execution makes possible a much greater level of Web interaction and multimedia effects, unhampered by HTML restrictions or network bandwidth. Java programs can display slick animations, invite users to play games, show step-by-step tutorial instructions, or run demonstration versions of computer software. When a browser accesses a standard HTML page, the result is usually a static display. When it runs a Java applet, however, the results are limited only by the creativity of the applet's developer. The applet is a nearly independent application running within the browser.

Getting Started

Java is an object-oriented programming language that resembles a simplified form of C++. Java code displays graphics, accesses the network, and interfaces with users via a set of capabilities--known as classes--that define similar states and common methods for an object's behavior. Unlike other programming languages, though, Java programs are not compiled into machine code; instead, they are converted into an architecture-neutral bytecode format. This collection of bytes represents the code for an abstract Java virtual machine (VM). In order for these bytes to execute on a physical machine, a Java interpreter running on that physical machine must translate those bytes into local actions, such as printing a string or drawing a button.

To run Java applets, you'll need a Java-enabled browser (such as Sun's HotJava, Netscape 2.0 or greater, or Internet Explorer 3.0 or greater) or you can use the appletviewer utility in Sun's Java Development Kit (JDK). The JDK also includes an interpreter for standalone Java applications (called simply java), as well as a debugger and compiler, called jdbg and javac respectively.

Java applets use a subset of the full Java VM, with a variety of features disabled for security reasons. You can add Java applets to your Web pages with the <APPLET> tag, which can include attributes for the applet's height, width, and other parameters. Java-capable browsers treat Java applets like other media objects in an HTML document: they are loaded with the rest of the page, then verified and executed.

NEXT


Mark Reynolds is a network protocol designer, Java programmer, computer animator, and fanatic mountaineer. He currently consults to Adaptive Optics Associates, a United Technologies company.

Reprinted from Web Developer® magazine, Vol. 2 No.1 Spring 1996 (c) 1996 internet.com Corporation. All rights reserved.


How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

XML error: undefined entity at line 19
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Linux Vendors Head to the Cloud in Search of Cash
iPhone 3GS: Overheating Fears, OS Update Nears
PostgreSQL 8.4 Revs Up Database Admin, Security
PHP 5.3 Accelerates PHP
Sun Releases NetBeans 6.7 IDE for Java, PHP
Why Firefox Doesn't Take Google Chrome Features
First Major PHP Update in Years Coming Soon
Red Hat CEO Calls on Oracle to Keep Java Open
Google Widens AdSense for iPhone, Android Apps
Eclipse Galileo Releases 33 Open Source Projects

A Taste of JavaFX for the Uninitiated
A Guide to Caching and Compression for High Performance Web Applications
How User-Centered Design Can Put User Stories in Proper Context
Explore C# 4's New Dynamic Types and Named/Optional Parameters
Enterprise Architecture: The Journey Begins Here, Part 2
Create a Syslog Sender/Receiver Using the MS Winsock Control
AMD CodeAnalyst Helps Developers Optimize and Tune Applications
Securing Microsoft's Cloud Infrastructure
Introducing the Azure Services Platform
An Introduction to Microsoft .NET Services for Developers

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs