Okay, well, as I have always said, an
example is worth a thousand pictures which is heck of a
lot of words. So I would like to conclude this tutorial
with a little JDBC application I put together.
Essentially, this application will
hook into my MSAccess database and allow me to search or modify
the contents of the CUSTOMERS table. If you have been following
along in this tutorial, you will already have set up such a
database and table. If not, you can imagine. Or better,
yet, you can modify a few lines, recompile and get this working
on your own databases and tables.
I have coded the application so that it should be very
easy for you to modify it for use at your site. All the GUI
design and site specific information have been separated out.
You need not worry about the implementation of the code besides changing
a few simply GUI sections and Strings.
There are 5 files in the application code:
- DataGrid.java - A Microline Component
Toolkit Grid Object. The MCT is free and available at
Neuron Data. There is no need
for you to edit this file.
- GlobalResources.java - There
are some implementation specific things defined here. You should
change them for your site and recompile. I have noted with comments which
lines you should change.
- MainFrame.java - The Main display frame.
Leave this alone.
- StartButton.java - The applet frontend.
Leave this alone.
- UserInterface.java - The definition of
the User Interface. You should change this to reflect your own
DB Table and recompile. Changes you need to make are commented.
The entire application with compiled classes is
zipped up here. When you run it,
you will see the following interface: