Step 9: The User Interface


Next, you need a user interface. This step will create a very simple user interface that will prompt for an item number and return a description. The business logic portion will be completely simulated; you'll write a method that just does a lookup against a hardcoded list of item numbers . You'll add the database interaction in Step 10.

Overview ”The thick client interface

Java has a number of options when it comes to user interfaces. One of the first tasks in any development project is to determine the interface (or interfaces) that will be required. In this book, you will be using a thick client interface-that is, one in which the majority of the user interface (UI) code runs on the client in a specially designed program. The UI is graphical in nature, supporting drag and drop, menu bars, and so on, like any typical Windows (or Macintosh or Gnome) application.

You'll use a thick client because it is the simplest to implement. There are no requirements for a Web application server as there would be with a browser-based interface.

Just because you've selected a thick client doesn't mean your job is over yet. Now you must decide which thick client interface to use. In earlier versions of Java, you chose between AWT (the Abstract Widget Toolkit) and Swing, but those days are gone, with Swing having all but completely replaced AWT in the general Java community.

But there is a newcomer, IBM's SWT, or Standard Widget Toolkit. SWT was designed to allow a faster, more native interface ”Swing, especially in early releases, was notoriously slow and not particularly appealing visually. Since then, strides have been made, but IBM chose to invent its own wheel for the Eclipse project, and thus were SWT and its companion technology, JFace, born.

This chapter is not the place to debate the pros and cons of SWT and Swing. You can read all manner of opposing viewpoints in the various forums, and I address the issue in a little more detail in Sidestep 4. However, for the purposes of this book, since Eclipse is our focus I thought I would also introduce you to the UI that Eclipse uses, namely SWT.




Eclipse
Eclipse: Step by Step (Step-by-Step series)
ISBN: 1583470441
EAN: 2147483647
Year: 2003
Pages: 90
Authors: Joe Pluta

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