> List of tutorials

Table of contents for this tutorial

Base lesson 2, step 2: Adding an action: selecting the file with the SQL-commands

For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

Last revision of this document:
2006-02-13

This step of the tutorial deals how to handle when a button is clicked (an action event occurs) and to code a method, that allows the selection of a file (the one containing the SQL-commands that should be executed against the database in a further step).

Preface:

The code written in this tutorial is far away from being optimized.
Emphasis of this tutorial is to develop the application in small steps where the completion of each step allows the application to be run eror-free and showing the result aimed by the step.
Therefore the code is written to be understandable in favor of being optimized
.

Credits:

A tutorial for dealing with event in JAVA can be found under http://java.sun.com/docs/books/tutorial/uiswing/events/intro.html .

Prerequisites:

Additional code to handle 'Clicks' onto buttons:

In the following explanations all new code is written in bold letters.
Code generated by the template or entered in previous steps (old code) is in italics.
Larger blocks of old code may be skipped.

top.


Additional class for 'actions':

To avoid overloading of the class JS_DBLoad with the elements with the GUI-elements, a class to hold the code for all actions is created.

top.


Creating directory and files for input (SQL-commands) and database-parameters:

As this step did not become so large, the creation of the files for input (SQL-commands) and parameters for the database-connection are covered now.

Next Step: