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.

 Internet.com eBook Library
 IBM Software Construction Toolbox
 Microsoft RIA Development Center
 Destination .NET
XML error: not well-formed (invalid token) at line 38
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%.

Mozilla's Ubquity Mashup: For The Masses?
iPhone Users Just Want to Have Fun
Oops! I Fixed the Linux Kernel
Jim Zemlin: The New Center of Linux Gravity
Microsoft's Novell Investment Tops $340M
Fedora 10 Takes Shape
IBM Gives a Mobile Voice to Developers
Inadequate Tools Send Software Down the Drain
USB 3.0 One Step Closer to Reality
Would-Be Linux Contributors May Get a Leg Up

Develop a Mobile RSS Feed the Easy Way
State of the Semantic Web: Know Where to Look
A 3D Exploration of the HTML Canvas Element
Setting Up and Running Subversion and Tortoise SVN with Visual Studio and .NET
Java/JRuby Developers, Say Open 'Sesame' to the Semantic Web
Interpreting Images with MRDS Services
DevXtra Editors' Blog: Executives Avoiding Cloud Computing in Droves
Q&A with James Reinders on the Intel Parallel Studio Beta Program
The Pros and Cons of Outsourcing Enterprise Emails
Hosting Options: Shared or Dedicated Server

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



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers