ResourceListPane and ResourceListDetailsPane

Use the ResourceListPane and ResourceListDetailsPane classes to present a resource list in a graphical user interface (GUI).

The table columns for a ResourceListDetailsPane are specified as an array of column attribute IDs. The table contains a column for each element of the array and a row for each resource object.

Pop-up menus are enabled by default for both ResourceListPane and ResourceListDetailsPane.

Most errors are reported as com.ibm.as400.vaccess.ErrorEvents rather than thrown exceptions. Listen for ErrorEvents in order to diagnose and recover from error conditions.

Example: Displaying a resource list in a GUI

This example creates a ResourceList of all users on a system and displays it in a GUI (details pane):

   // Create the resource list.
   AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
   RUserList userList = new RUserList(system);

   // Create the ResourceListDetailsPane.  In this example,
   // there are two columns in the table.  The first column 
   // contains the icons and names for each user.  The
   // second column contains the text description for each
   // user.
   Object[] columnAttributeIDs = new Object[] { null, RUser.TEXT_DESCRIPTION };
   ResourceListDetailsPane detailsPane = new ResourceListDetailsPane();
   detailsPane.setResourceList(userList);
   detailsPane.setColumnAttributeIDs(columnAttributeIDs);

   // Add the ResourceListDetailsPane to a JFrame and show it.
   JFrame frame = new JFrame("My Window");
   frame.getContentPane().add(detailsPane);
   frame.pack();
   frame.show();

   // The ResourceListDetailsPane will appear empty until
   // we load it.  This gives us control of when the list
   // of users is retrieved from the iSeries.
   detailsPane.load();