Aqua Phoenix
     >>  Lectures >>  Java 5  
 

Navigator
   
 
       
   

5.1 Overview

Java Applications, unlike Java Applet, are fully functional software packages that can take advantage of most OS functions, including File I/O, Serial and Parallel I/O, etc. Java Applications still make use of the Virtual Machine, but through libraries (DLLs or SOs), even low-level video functionality can be made available at uncompromised speeds.

The Swing package includes a number of GUI widgets, which are far more extensive in quality and quantity than the AWT widgets. Swing is included in a Java class by importing the following packages:

    javax.swing: most basic GUI components
  • javax.swing.colorchooser: a fully functional Color Chooser widget similar to those found in Photoshop, etc.
  • javax.swing.table: components of the table widget, which has the functionality of a spreadsheet
  • javax.swing.tree: components of the tree widget, which is similar to the Windows Explorer folder view
  • javax.swing.text: components of text editors

javax.swing is the most important package - it contains all of the basic widgets. All of the widgets from AWT have a counterpart in the Swing package. Table 5.1 draws the parallels.

Swing GUI components tend to begin with the letter J, e.g. instead of an AWT Button, we use the Swing JButton. Besides the change in name, Swing components also have a look and feel that is different from that of AWT. While AWT components adapted to the underlying Windowing GUI (Windows, Motif, etc.), Swing has its own unique style. This style can, however, be changed.

Java applications are compiled using javac and run using java . There is no need for a special sandbox environment as was necessary for Java applets. Since Java Swing applications do not appear as objects on web pages, there is also no need for an HTML page and APPLET tags.

The main entry point for a Java application remains to be public static void main(String[] args) . From within this method, the Java application class can be instantiated and built. Examples follow later.