A VPrinter object is a resource that represents an AS/400 printer and its spooled files for use in AS/400 panes.
To use a VPrinter, set the printer property. Set this property by using a constructor or through the setPrinter() method. The VPrinter object is then "plugged" into the AS/400 pane as the root, using the pane's constructor or setRoot() method.
When AS/400 pane and VPrinter objects are created, they are initialized to a default state. The printer's attributes and list of spooled files are not loaded at creation time.
To load the contents, the caller must explicitly call the load() method on either object. This will initiate communication to the AS/400 system to gather the contents of the list.
At run-time, a user can perform actions on any printer or spooled file through the pop-up menu. The following actions are available for printers:
Users can only access printers and spooled files 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 VPrinter and presents it in an AS400ExplorerPane:
// Create the VPrinter object. // Assume that "system" is an AS400 // object created and initialized // elsewhere. VPrinter root = new VPrinter (new Printer (system, "MYPRINTER")); // Create and load an // AS400ExplorerPane object. AS400ExplorerPane explorerPane = new AS400ExplorerPane (root); explorerPane.load (); // Add the explorer pane to a frame. // Assume that "frame" is a JFrame // created elsewhere. frame.getContentPane ().add (explorerPane);
Present print resources using an AS400ExplorerPane with a VPrinter object.
The following image shows the VPrinter graphical user interface component:
VPrinter GUI component |
![]() |