The Graphical Toolbox provides a redistributable API that your Java programs can use to display user interface panels defined using PDML. The API displays your panels by interpreting the PDML and rendering your user interface using the Java Foundation Classes.
The Graphical Toolbox runtime environment provides the following services:
The elements of the Graphical Toolbox runtime environment are
shown in Figure 1. Your Java program is a client of one or
more of the objects in the Runtime Managers box.
Figure 1. Graphical Toolbox Runtime Environment |
![]() |
import com.ibm.as400.ui.framework.java.*;
// Create the panel manager. Parameters:
// 1. Resource name of the panel definition
// 2. Name of panel
// 3. List of DataBeans omitted
PanelManager pm = null;
try {
pm = new
PanelManager("com.ourCompany.ourPackage.TestPanels",
"MyPanel",
null);
}
catch (DisplayManagerException e) {
e.displayUserMessage(null);
System.exit(-1);
}
// Display the panel
pm.setVisible(true);
Once the DataBeans that supply data to the panel have been
implemented and the attributes have been identified in the PDML,
the following code may be used to construct a fully-functioning
dialog:
import com.ibm.as400.ui.framework.java.*;
import java.awt.Frame;
// Instantiate the objects which supply data to the
panel
TestDataBean1 db1 = new TestDataBean1();
TestDataBean2 db2 = new TestDataBean2();
// Initialize the objects
db1.load();
db2.load();
// Set up to pass the objects to the UI
framework
DataBean[] dataBeans = { db1, db2 };
// Create the panel manager. Parameters:
// 1. Resource name of the panel definition
// 2. Name of panel
// 3. List of DataBeans
// 4. Owner frame window
Frame owner;
...
PanelManager pm = null;
try {
pm = new
PanelManager("com.ourCompany.ourPackage.TestPanels",
"MyPanel",
dataBeans,
owner);
}
catch (DisplayManagerException e) {
e.displayUserMessage(null);
System.exit(-1);
}
// Display the panel
pm.setVisible(true);
A new service has been added to the existing panel manager. The dynamic panel manager dynamically sizes the panel at runtime. Let's look at the MyPanel example again, using the dynamic panel manager:
import com.ibm.as400.ui.framework.java.*;
// Create the dynamic panel manager.
Parameters:
// 1. Resource name of the panel definition
// 2. Name of panel
// 3. List of DataBeans omitted
DynamicPanelManager dpm = null;
try {
pm = new
DynamicPanelManager("com.ourCompany.ourPackage.TestPanels",
"MyPanel",
null);
}
catch (DisplayManagerException e) {
e.displayUserMessage(null);
System.exit(-1);
}
// Display the panel
pm.setVisible(true);
When you instantiate this panel application you can see the dynamic sizing feature of the panels. Move your cursor to the edge of the GUI's display and, when you see the sizing arrows, you can change the size of the panel. The display changes without changing the size of the text.