Professional Documents
Culture Documents
Hao ADF Swing
Hao ADF Swing
Tutorial
09/29/07
Shuang Hao
1. Open JDeveloper and make a database connection:
1 Select
connections
2 right click 3 select “new database
database conncetion”
Then input the username and password that the systems administer assigned to you.
Your username
Your password
click
Chang to oracle.cis.ksu.edu
Chang to ORACLE
click
1. Click
2. Click
Then the tables in the database can be seen here:
Should be your username
2. Make a new application
1
2.Right click
3. Select it
Make some small changes as followings:
Then Click here
Then click here
Select it first
Then click here
Then click
Right now, a new empty application is created.
1 Right click
2 Select it
In the following window,
Then Select
Select it first
Last, click it
In the next window, just click “OK”.
Then in the new window as following, move “department” and “employee” from
“Available” to “Selected” by clicking “>” button. Then click “Next”.
In the next window, click “>>” to select all.
In the next window, change Object Name as EmployeeVO and DepartmentVO,
resp.
1. Change name
2.
Click
1. Click it
2. Add it
3. Change name
4. Click it
Change
name
Then click
Only Click “Next ” in the next window, and then Just click “Finish” in the next step.The
working space should look like this:
3. Creating a Master‐Detail ADF Swing Form
1. Right click UserInterFace
2. Select New
In the following window,
2. Select it
1.Select it
Then click “OK” to get to another window.
Change name
Then click
The resulting workspace should look like this:
In the workspace , select Navigation Bar then right click, select cut to delete it.
Then select cut to
Select it, delete it
and then
right click
Click here first
Add name
1. Click here
2. Select
The resulting window should look like
this:
1
Select it
3 2 drag it
Add TextFields:
1
Select it
2 drag it to 3
3
4 Select TextField
Repeat the same 1.2.3.4 steps for “shortname” and “name”. And then add labels for
each of them as following:
1 Select ADF
Swing Controls
3
2 Drag it to 3
Repeat the same steps for another two, the resulting is as following picture, then right
click each label, select “create binding”—>“Label for”:
In the DepartmentVO1, select a suitable attribute according to the Textfield that it
labels
for.
The resulting window is as:
Add a Scrollbar:
1
2. drop it to 3
3
4. select it
Add a ScrollPane:
1. Drag it to 2
2
3. Select Table
Result should look
like this
Then in the Navigator,
6 move
them
here
5 Select
1.Click it
2. Open it
3. Click it
4. Double click
7
Close MDForm.java first, and then reopen
it. It should look like this:
Add a NavigatorBar for the table:
1
2 Drag it to 3
3
4 select it
Click MDForm.java then run it, the coming window should look like this:
Adding a Combo Box to a Detail attribute:
3
Select
4. Change
it
to
ComboBox
5. Click
1 select
6. Click
2 double click
1.
Select
2. Click
3. Select
4. Click
Change to
Deptno
Change to
Name
Click “OK” and then run it. Click “deptno”, we can see a Combo Box as in the following picture.
2. See the combo box
4. Creating an Edit Form
In the Applications Navigator, right‐click the View node and select the “New”. Select
“ADF Swing” Æ”Empty Panel”, and click “OK”.
Change Panel or Frame name to ”EmployeeEdit”:
1
The working space should look select
2 drag it to 3
3
4. Select it
like:
Without changing anything, just clik “OK”, then this window will show up:
In the Navigator Bar, double click “PanelEmployeeVO2Helper.java”; and then select
“design” pattern; third, select the panel and set the layout property to Vertical Flow
Layout.
1.
3
2
Select any edit form label column and right click to select the” Column Properties”.
Change to None
Select the navigation bar in the panel and open the Property Inspector. Set
“hasFindButton“ False, “hasInsertButton” False and “hasNavigationButton” False.
1. Click
on it
2.
3. Set false
Open the “MDForm.java” in the design editor, and drag the “EmployeesEdit.java”
from the Applications Navigator into the last row, first column of the “MDForm.java”
as shown here:
1
open
2 Drag it to 3
4. Select it
3
Change text on the button:
Change text
Run the MDForm.java, on the running window, click on a record row, and then click
“Edit” button.
Click
The EmployeeEdit form with the selected record will show up, we can edit the
information in this form.