Chapter 26. An Introduction to Java GUIs


In Chapter 25, we discussed three ways to read input data into an application and two ways to write the output out. Using command line arguments, the standard I/O streams, or file I/O are good choices for many applications. There is another way for an application to read and write data ”by creating a GUI front end to the application. The GUI provides a visual display of both the inputs and outputs from an application.

There are many benefits to using GUIs with your analysis tools. The application becomes more visual. The user can see the inputs and outputs on her console. A GUI can clearly present the acceptable input choices to the user. For example, if a particular input argument has only three acceptable values you can place these values in a list component that displays only those values. The user will have to select one of the three choices from the list, eliminating the possibility of mistyping or not knowing the proper input argument choices. A GUI provides self-contained I/O. There are no input files to create or edit.

It would take an entire book to cover all the details and possibilities of the Java GUI libraries. The purpose of this chapter is to outline the process of developing a Java GUI. It will highlight the various steps in building a GUI and talk about the basic elements common to all GUIs. We will also go over some of the design decisions that you will have to make when you create a GUI. We will introduce some of the GUI classes and methods , but for a comprehensive look at the Java GUI libraries, consult Graphic Java 2, Volume 2: Swing (3rd ed.) by David Geary.

The topics we will discuss in this chapter are ”

  • The Java GUI libraries

  • The AtmGUI class

  • Choosing a container

  • Selecting the GUI components

  • Adding the components to the container

  • Event handlers

  • Other GUI elements

  • The final form of the AtmGUI class



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net