VPrinter class

A VPrinter object is a resource that represents a server printer and its spooled files for use in AS400Panes.

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 AS400Pane as the root, using the pane's constructor or setRoot() method.

When AS400Pane 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 server to gather the contents of the list.

At run-time, a user can perform actions on any printer or spooled file by right-clicking it to display the context menu. The context menu for message queues can include the following items:

The context menu for spooled files listed for a printer can include the following items:

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);
Example

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

Figure 1: VPrinter GUI component

VPrinter GUI component