126 lines
4.8 KiB
HTML
126 lines
4.8 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="VPrinterOutput Example" />
|
|
<meta name="abstract" content="" />
|
|
<meta name="description" content="" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="vprinteroutputexample" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>VPrinterOutput Example</title>
|
|
</head>
|
|
<body id="vprinteroutputexample"><a name="vprinteroutputexample"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">VPrinterOutput Example</h1>
|
|
<div><p></p>
|
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code
|
|
example disclaimer</a> for important legal information.</div>
|
|
</div>
|
|
<div class="section"><div class="p"><pre>//////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// VPrinterOutput example. This program presents a list of spooled
|
|
// files on the server. All spooled files, or spooled files for
|
|
// a specific user can be displayed.
|
|
//
|
|
// Command syntax:
|
|
// VPrinterOutputExample system <user>
|
|
//
|
|
// (User is optional, if not specified all spooled files on the system
|
|
// will be displayed. Caution - listing all spooled files on the system
|
|
// and take a long time)
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
import com.ibm.as400.access.*;
|
|
import com.ibm.as400.vaccess.*;
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
import java.awt.event.*;
|
|
|
|
public class VPrinterOutputExample
|
|
{
|
|
|
|
|
|
public static void main (String[] args)
|
|
{
|
|
|
|
// If a system was not specified, display help text and exit.
|
|
if (args.length == 0)
|
|
{
|
|
System.out.println("Usage: VPrinterOutputExample system <user>");
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
// Create an AS400 object. The system name was passed
|
|
// as the first command line argument.
|
|
AS400 system = new AS400 (args[0]);
|
|
system.connectService(AS400.PRINT);
|
|
|
|
// Create the VPrinterOutput object.
|
|
VPrinterOutput printerOutput = new VPrinterOutput(system);
|
|
|
|
// If a user was specified as a command line parameter, tell
|
|
// the printerObject to get spooled files only for that user.
|
|
if (args.length > 1)
|
|
printerOutput.setUserFilter(args[1]);
|
|
|
|
|
|
// Create a frame to hold our window.
|
|
JFrame f = new JFrame ("VPrinterOutput Example");
|
|
|
|
// Create an error dialog adapter. This will display
|
|
// any errors to the user.
|
|
ErrorDialogAdapter errorHandler = new ErrorDialogAdapter (f);
|
|
|
|
|
|
// Create an details pane to present the list of spooled files.
|
|
// Use load to load the information from the system.
|
|
AS400DetailsPane detailsPane = new AS400DetailsPane (printerOutput);
|
|
detailsPane.addErrorListener (errorHandler);
|
|
detailsPane.load ();
|
|
|
|
|
|
// When the frame closes, exit.
|
|
f.addWindowListener (new WindowAdapter () {
|
|
public void windowClosing (WindowEvent event)
|
|
{
|
|
System.exit (0);
|
|
}
|
|
});
|
|
|
|
// Layout the frame with the details pane.
|
|
f.getContentPane ().setLayout (new BorderLayout ());
|
|
f.getContentPane ().add ("Center", detailsPane);
|
|
f.pack ();
|
|
f.show ();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
System.out.println ("Error: " + e.getMessage ());
|
|
System.exit (0);
|
|
}
|
|
}
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |