VPrinters class

A VPrinters object is a resource that represents a list of printers for use in AS400Panes.

To use a VPrinters object, set the system property. Set this property by using a constructor or through the setSystem() method. The VPrinters object is then "plugged" into the AS400Pane as the root, using the pane's constructor or setRoot() method.

A VPrinters object has another useful property for defining the set of printers that is presented in AS400Panes. Use setPrinterFilter() to specify a filter that defines which printers should appear.

When AS400Pane and VPrinters objects are created, they are initialized to a default state. The list of printers has not been loaded. To load the contents, the caller must explicitly call the load() method on either object.

At run-time, a user can perform actions on any printer list or printer by right-clicking it to display the context menu. The printer list context menu can include an item called Properties that allows the user to set the printer filter property, which can change the contents of the list.

The printer context menu can include the following items:

Users can only access printers to which they are authorized. In addition, the caller can prevent the user from performing actions by using the setAllowActions() method on the pane.

The following example creates a VPrinters object and presents it in an AS400TreePane

                       // Create the VPrinters object.
                       // Assume that "system" is an AS400
                       // object created and initialized
                       // elsewhere.
     VPrinters root = new VPrinters (system);

                       // Create and load an AS400TreePane
                       // object.
     AS400TreePane treePane = new AS400TreePane (root);
     treePane.load ();

                       // Add the tree pane to a frame.
                       // Assume that "frame" is a JFrame
                       // created elsewhere.
     frame.getContentPane ().add (treePane);
Example

Present print resources using an AS400ExplorerPane with a VPrinters object. Figure 1 shows the VPrinters graphical user interface component:

Figure 1: VPrinters GUI component

VPrinters GUI component