|
|
|
Last
revision of this document: |
This
step of the tutorial deals with the creation of a project for the
base-classes and incorporating the created project into the
'Build-Path' of the project for the Fat-Client.
Preface:This
step has to be done, if you want to code the base-classes for
Fat-Client-Development.
As
an alternative you may download the jar-file with the base-classes
and define this jar-file in the 'Build-Path'.
This is described
in the document JS_FC01cb
- Download the jar-file for the base-classes.
Credits:None
for this document; I developed all by myself ;-) .
JS_FC01b
- Create a new workspace and a project in Eclipse
completed – and
its prerequisites too.
Create
the project (base-classes):
To
create a new project, select >File>New>Project.
In
the New Project window select >Java Project and
press the [Next >] button thereafter.
Enter
the Project Name (JS_Base),
select 'Create
separate source and output folders',
leave all other values
unchanged and press
the [Next >] button thereafter.
Change
the 'Default output folder' to JS_Base/gen/classes,
select the 'src' folder
and then click the Remove
source folder 'src' from build path text.
Click
the
to create the
project.[
Finish ] button
To
define a new source-folder (where the java code resides)
select
the project 'JS_Base' and click the right mouse-button.
Then
select 'Properties'.
Select
'Java Build Path', then the tab 'Source' and click the
.[
Add Folder... ] button
Select
'src' -
but make sure, that it is not checked - and click t.he
[ Create New Folder... ] button
Enter
'java' (the name of the new folder) and click the
.[
OK ] button
Check
that the new folder was created and click the
.[
OK ] button
Click
the
to
close the 'Properties' window.[
OK ] button
Add
the base-classes as 'Source' in the 'Build Path' of the project for
the Fat-Client:
To
get to the configuration, select the project JS_FC01, then
click the right mouse-button and on the menu popping up select
>Properties.

Select
Java Build Path (in the left frame) and Projects (on
the tab), then click the
[ Add... ] button.
The
window popping up shows a list of all other projects in the
workspace.
Classes of JS_Base will be used by JS_FC01; so
JS_Base has to be included in the Build Path.
Mark the project
JS_Base, then click the [ OK ] button.
Close
the 'Properties' window by clicking the [ OK ]
button.
Create
the base-class for the Start-Frame (with no code for now):This
class contains code for variables and methods that can be reused for
all individual developments.
The class created now can the be
inhereted (therefore it is called base-class) by individual projects.
Right
click onto the project 'JS_Base' and select
>New>Class
Enter
the Package (js_base.frame),
the (Class-)Name (JSBS_StartFrame),
check that no checkbox is selected; then click the [Finish]
button.
Eclipse
has already generated a template and the individual code can be
entered.
For
now, there is not already code to enter.
Pieces of code going
into this class are developed step by step in the next steps of this
tutorial.
Whenever a piece of code has to be written into the
class JSBS_StartFrame it is listed and explained when it is needed
by a class inheriting class JSBS_StartFrame.
Just
the inherited class (JFrame)
and comment is entered now: package
js_base.frame;
import
javax.swing.*;
/***
* @author kurt@javascout.biz
*
@date 2006-05-03
*
* @description
* Frame to be inherited
by Start-Frames (usually called 'Command-Center') of*
This class contains variables for*
Fat-Client-Applications. *
*
* defining if the application has direct access to a database*
@change-log
*
or is connected to a Java-Application-Server (JAS)*
* holding the connection to the database or JAS respectively*
* XML-tree for parameters to access the database or JAS*
* XML-tree with text-elements in the selected language*
* a structure with various parameters* e.g.
selected language, logged on user, TCP/IP-address, etc. *
* when who why
*
--------------------------------------------------------
*
*/public
class JSBS_StartFrame
extends
JFrame{
Next
Step:A
simple GUI is created:
JS_FC01d
- Create and code the class for the GUI.