The Wayback Machine - https://web.archive.org/all/20050403233207/http://java.sun.com:80/developer/onlineTraining/new2java/divelog/
Skip Masthead Links developers.sun.com   » search tips  |  Search:     
The Source for Developers
A Sun Developer Network Site
Products and Technologies
Technical Topics
Sun Microsystems
 
 
Tutorials & Code Camps
Building an Application: Introduction
 

New to Java Programming Center
Programming Center

Overview

What You Need

Start the Tutorial

Overview

Many different Java Application Programming Interfaces (APIs) are used in application programming. As you learn how to create buttons or write text to files, figuring out how to fit the technologies together into a single application can be difficult and confusing. Seeing an application built from the ground up can be more useful than just reading how to make a menu bar or read a file into a Graphical User Interface (GUI).

This six-part tutorial details application development, using a single fully-featured application as an example. You'll learn how to:

  • Use predefined objects and create new objects.
  • Call predefined methods and write new methods.
  • Create GUI components, such as tabbed panes, buttons, menus, text fields, and text areas.
  • Use AWT layout managers and event handlers.
  • Print text and images to the screen.
  • Read from and write to files.
  • Open an HTML page in the application and activate the links.

You'll also learn about packages and, how to package an application for distribution, and the Java technologies referred to as Java I/O, Project Swing, and AWT.


Click to enlarge

The application created for this series tutorial is a simple dive log, such as one a scuba diver might use to record dive depth, water temperature and conditions, and amount of air consumed.

Although a certified scuba diver might find that this application falls short of being a robust, detailed dive log, it serves well as an example application, demonstrating features commonly used in application programming.

The tutorial begins with simple concepts and leads to more complex programming techniques, introducing deeper concepts and repeating programming techniques throughout.

  • The first half of each series part explains how to create the GUI for that particular pane.
  • The second half details the functionality of buttons, menus, text fields, and so forth.

This tutorial is aimed at beginning programmers, or developers new to Java technology. Though programming concepts are introduced and many explained in great detail, this is not intended to be a comprehensive tutorial for all Java programming syntax.

What You Need

You don't need to be a certified scuba diver to follow this tutorial (though diving is a lot of fun and you might consider trying it). You also don't need a lot of experience with the Java programming language.

Familiarity with programming is helpful, and it's recommended that you at least understand what the Java platform is and how to set it up on your computer.

If Java technology is new to you, read the following articles before starting the tutorial:

About Java Technology
Introducing the Java Platform
Setting Up and Getting Started

The following software is required to compile the code in this tutorial:

  • Java 2 Platform, Standard Edition (J2SE)
    This dive log was created using J2SE version 1.3. J2SE includes the compiler and API needed for creating the Java technology dive log.
  • A simple text editor for writing classes. If you use a full-fledged word processor, save class files as text and create a .java extension. Examples are given in the tutorial.

    Optional
    Sun ONE Studio 4
    This is an Integrated Development Environment (IDE) that enables you to write, compile, and run code within one application. In addition, it has short cut features to use for creating buttons, toolbars, and many other widgets or components. Learning an IDE can be time-consuming, so many programmers opt for a simple text editor and use the command line for compiling.

Start the Tutorial

If a dive log is not to your liking, feel free to change the text and code to better suit your needs. Perhaps you'd rather design a diet or exercise log, or some other kind of application. You can learn a lot by taking prewritten code and changing it. In fact, that is the theme of object-oriented programming: Reuse, don't start from scratch.

As each part of the tutorial is published, the titles below will become available. With that in mind, start the tutorial:

Part 1: Application Objects, Classes, Constructors, and Methods (October 2001)
Part 2: Inheritance, Images, Text, and Layouts (December 2001)

Building an Application Quiz Test what you learned from the Building an Application tutorial series parts 1 and 2 about basic Java programming fundamentals.

Part 3: Receiving User Input Through Text Fields and Check Boxes, and the Basics Event Handling

(January 2002)

Part 4: Scroll Bars, Pop-up Option Boxes, Reading From and Writing to Files (June 2002)

Part 5: Writing objects to files and reading them back into the UI. (August 2003)

Part 6: Displaying HTML and Activating Links (Not yet available)