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:
  • Hold - holds the printer
  • Release - releases the printer
  • Start - starts the printer
  • Stop - stops the printer
  • Make available - makes the printer available
  • Make unavailable - makes the printer unavailable
  • Properties - displays properties of the printer and allows the user to set filters
The context menu for spooled files listed for a printer can include the following items:
  • Reply - replies to the spooled file
  • Hold - holds the spooled file
  • Release - releases the spooled file
  • Print next - prints the next spooled file
  • Send - sends the spooled file
  • Move - moves the spooled file
  • Delete - deletes the spooled file
  • Properties - displays many properties of the spooled file and allows the user to change some of them

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