DG COMPUTER EDUCATION

Monday 25 June 2012

Java Applet


Java Applet Tutorial

Designers and artists: this tutorial emphasizes visual and interactive aspects of applets. It was made especially for people wishing to create small, graphical, expressive forms with Java. However, if you have no programming experience at all, you'll probably need additional learning resources. Please see the note below for first-time programmers.
Before getting started, you'll need a compiler for Java, so that you can translate source code into something executable. You could, for example, download Sun's Java Software Development Kit (abbreviated as JDK or SDK), which includes a compiler, utilities, example applets, and a boat-load of documentation. (Mac users can try herehere and here.) Be sure to get the Java SDK and not the JRE (Java Runtime Environment) -- the former allows you to compile java programs, the latter only allows you to run them.
After getting a compiler, you can try out the examples. The first one, "Drawing Lines", walks you through the process of creating an applet. Please note that lessons 9-12 are unfinished, as I have yet to get around to completing them.
Drawing Lines
Drawing Other Stuff
Color - introduces arrays
Mouse Input - introduces showStatus( ) and Vector
Keyboard Input
Threads and Animation - introduces System.out.println( )
Backbuffers - introduces Math.random( ) and Graphics.drawImage( )
Painting
Clocks
10 Playing with Text - introduces 2D arrays and hyperlinks
11 3D Graphics - introduces classes
12 Odds and Ends
              

All of these examples were designed to be small and, hopefully, easy to absorb. If you couldn't find information here that you need, you might try Sun's website, which has copious documentation on Java, along with online tutorials and examples. You might also try the Java FAQ, a copy of which can be found by searching for "java faq" in any good search engine (or just try here -- the same site also hosts a tutorial).
If you're looking for books on Java, O'Reilly publishes some good ones, although they are most useful to people with at least a bit of prior programming experience. Java in a Nutshell by David Flanagan (in its 3rd edition, at the time of writing) covers the basic features of Java, including the syntax of the language, data structures, object-oriented features, and threads. Determined novices with no programming experience may find it useful.Java Foundation Classes in a Nutshell by David Flanagan describes how to create GUIs with widgets and how to draw basic graphics, among other things. Java 2D Graphics by Jonathan Knudsen, also published by O'Reilly, discusses in detail the graphics features of the Java 2 platform.
First-time programmers will probably find that the explanations given in this tutorial are too brief and leave out too many details. Basic information on the Java language can be found here (try to focus on understanding the syntax of variables, expressions, loops, and flow control structures at first -- we hardly make use of any object-oriented concepts in this tutorial). There are some books on Java for first-time programmers: this siterecommends Java: An Introduction to Computer Science and Programming by Walter Savitch et al., Problem Solving With Java by Elliot B. Koffman and Ursula Wolz, and Introduction to Programming Using Java: An Object-Oriented Approach by David M. Arnow and Gerald Weiss. You might also try getting a feel for some basic programming concepts by learning a simpler language first, such as DBN.

No comments:

Post a Comment