O'Reilly logo

Oracle and Open Source by Sean Hull, Andy Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java GUIs

Now that we’ve looked at the basics of the JDBC API, let’s do something interesting with GUI clients. Our goal is to figure out how Java works at this level, as well as to provide an example along the lines of the Wosql and OraExplain programs (see the discussion of Tcl/Tk and Perl/Tk, respectively, in Chapter 3). Most of the open source Java projects described in Chapter 8, also involve GUIs, so it will be helpful to look at how you can use Java to build such applications. First we’ll build a basic GUI, and then we’ll blend some JDBC into it so we will be able to connect to an Oracle database.

Java Swing

The quickest way to get going with a Java GUI is to use the Java Swing library. Java Swing is an extension of AWT, and these two GUI toolkits are intimately related:

AWT

AWT, the original Abstract Windowing Toolkit, comes with the standard JDK distribution. It handles simple graphics, widgets, and layout managers for different native formats.

Swing

Although it relies on AWT, Swing is entirely Java-based and covers a far more generalized and flexible set of GUI capabilities through its Java Foundation Classes (JFC). It used to come in a separate package from Java Version 1, but it’s now entirely integrated within the Java2-based JDKs.

The main web site for Java Swing is the Swing Connection, where you can find out about Swing and all of its many component GUI widgets:

http://java.sun.com/products/jfc/tsc/index.html

There are also many GUI builders available to help create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required