First steps with JEasy
Work with JEasy in your favorite Development Tool.
A good and free IDE is eclipse (www.eclispe.org).
-
Create a new project with the project wizard.
It will generate the both sources MyProg.java and RunMyProg.java out of the Template sources.
Call makeMyProgjar.bat to compile or from the command line
javac -deprecation -classpath jeasy.jar MyProg.java
javac -deprecation -classpath jeasy.jar RunMyProg.java
jar cmf MANIFEST.MF Template.jar *.class *.xml resources
Start the program with
RunMyProg.bat or java -jar -cp jeasy.jar MyProg.jar
Start the JEasyRepository to change the MyProg.xml GUI file
Add your own objects
-
Make a new menu item by using a new ID and clicking on Save.
To make a new menuitem, either select the tabbedpane "menuitem" or select
an existing item (such as MI_About). Set or change its ID, for example
set it to "MI_Contents". Fill in any other desired fields.
As long as the ID is unique, clicking Update/Save button will create
a new item.
-
Now add the menu item to a parent by editing the parent and adding the
item.
Select the Menu ME_Help in the left hierarchy tree by clicking on the item ME_Help. At the bottom
of the center panel, click on the button to the right of "elements".
In the window that comes up, insert MI_Contents into ME_Help by
moving it from the list on the left to the list on the right.
You can change its order using the up and down arrows.
Close the window with "ok". Then save your changes with the Update/Save
button.
-
Preview your changes.
To start the preview, in the left treeview, select the frame FR_MyFrame.
Click the right mouse button to start the preview. In the preview, select the menuitem
MI_Contents which you inserted and notice that its event is logged.
To see the events open the left tabbedpane window out.
Handle the new menuitem in your
program
-
If you select the new menuitem, the listener inside
JEMenu is called. The AWTEvent and other parameters are used for the callback-function
that is implemented in your program. The parameter id is the reference
to MI_Contens. Look at the source for handling menuitem. Insert the code in your RunMyProg.java under the event callback
public void callBack(AWTEvent e, String ID, String ID_Parent) {
...
else if (ID.equals("MI_Contents")) {
System.out.println("Event: MI_Contents");
}
...
Add a new field in the form Address
of the Example
-
Load the project file Example.xml from JEasy/Examples/ into the Repository.
Create a new object of type dataclass and an object datafield with a reference
to the dataclass. Select the panel PA_AdrForm. Click on the button behind
the elements will open a new panel. Insert your new datafield by double click.
-
Save the changes with Update/Save and have a preview
of the panel by clicking the right mouse button on the selected panel PA_AdrForm
at the left treeview. Save the project file and start the application with
java -cp .;../lib/jeasy.jar;servlet.jar Example
You will see that no coding was necessary to store
the entries of the new datafield.
Write data to messages
-
Messages are used to get and to write entries of
a form. Messages are strings containing the values of input/output objects
on forms. The message MS_Address has a reference to PA_AdrForm. The method
getMessage will write data from the panel to the message, putMessage will
fill the panel out of entries of the message
Write messages to stores
-
In the example the addresses are stored by the object
store. A store saves messages into a random-access file. A store has functions
for reading, writing and searching. A store is not and will not be a database.
You may use it only for small amount of data. But it is very useful during
prototyping.
|
|
|