170 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
javax.print
</div>
<h2 class="title" title="Class ServiceUI">Class ServiceUI</h2>
</div><div class="contentContainer">
<ul class="inheritance">
<li><a href="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>javax.print.ServiceUI</li>
</ul> </li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr/> <br/> <pre>public class <span class="typeNameLabel">ServiceUI</span>
extends <a href="../../java/lang/Object.html" title="class in java.lang">Object</a></pre>
<div class="block">
<span>该类是UI便利方法的集合其提供用于浏览通过Java Print Service API查找的打印服务的图形用户对话框。</span>
<p> <span>对话框遵循用作用户的继续/取消选项的标准模式,并允许用户选择要使用的打印服务,并指定诸如纸张大小和份数等选项。</span> </p>
<p></p>
<p> <span>这些对话框旨在通过这些打印服务的公共API来处理可插拔打印服务。</span> </p>
<p> <span>如果打印服务提供任何供应商扩展,这些可以通过供应商提供的选项卡面板组件使用户可访问。</span> <span>鼓励这样的供应商扩展使用Swing</span> <span>并支持其可访问性API。</span> <span>供应商扩展应该返回设置作为AttributeSet的一部分。</span> <span>希望保留用户设置的应用程序应使用这些设置来指定打印作业。</span> <span>请注意此类不被Java打印服务的任何其他部分引用并且可能不会包含在不依赖于AWT包的存在的配置文件中。</span> </p>
</div> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- --> </a> <h3>构造方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Constructor Summary table, listing constructors, and an explanation">
<caption>
<span>构造方法</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../javax/print/ServiceUI.html#ServiceUI--">ServiceUI</a></span>()</code> </td>
</tr>
</tbody>
</table> </li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t1"><span><a href="javascript:show(1);">静态方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t4"><span><a href="javascript:show(8);">具体的方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code>static <a href="../../javax/print/PrintService.html" title="interface in javax.print">PrintService</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/print/ServiceUI.html#printDialog-java.awt.GraphicsConfiguration-int-int-javax.print.PrintService:A-javax.print.PrintService-javax.print.DocFlavor-javax.print.attribute.PrintRequestAttributeSet-">printDialog</a></span>(<a href="../../java/awt/GraphicsConfiguration.html" title="class in java.awt">GraphicsConfiguration</a> gc, int x, int y, <a href="../../javax/print/PrintService.html" title="interface in javax.print">PrintService</a>[] services, <a href="../../javax/print/PrintService.html" title="interface in javax.print">PrintService</a> defaultService, <a href="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</a> flavor, <a href="../../javax/print/attribute/PrintRequestAttributeSet.html" title="interface in javax.print.attribute">PrintRequestAttributeSet</a> attributes)</code>
<div class="block">
向用户呈现一个对话框,用于选择打印服务(打印机)。
</div> </td>
</tr>
</tbody>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- --> </a> <h3>Methods inherited from class java.lang.<a href="../../java/lang/Object.html" title="class in java.lang">Object</a></h3> <code><a href="../../java/lang/Object.html#clone--">clone</a>, <a href="../../java/lang/Object.html#equals-java.lang.Object-">equals</a>, <a href="../../java/lang/Object.html#finalize--">finalize</a>, <a href="../../java/lang/Object.html#getClass--">getClass</a>, <a href="../../java/lang/Object.html#hashCode--">hashCode</a>, <a href="../../java/lang/Object.html#notify--">notify</a>, <a href="../../java/lang/Object.html#notifyAll--">notifyAll</a>, <a href="../../java/lang/Object.html#toString--">toString</a>, <a href="../../java/lang/Object.html#wait--">wait</a>, <a href="../../java/lang/Object.html#wait-long-">wait</a>, <a href="../../java/lang/Object.html#wait-long-int-">wait</a></code></li>
</ul> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- --> </a> <h3>构造方法详细信息</h3> <a name="ServiceUI--">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>ServiceUI</h4> <pre>public ServiceUI()</pre> </li>
</ul> </li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="printDialog-java.awt.GraphicsConfiguration-int-int-javax.print.PrintService:A-javax.print.PrintService-javax.print.DocFlavor-javax.print.attribute.PrintRequestAttributeSet-">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>printDialog</h4> <pre>public static <a href="../../javax/print/PrintService.html" title="interface in javax.print">PrintService</a> printDialog(<a href="../../java/awt/GraphicsConfiguration.html" title="class in java.awt">GraphicsConfiguration</a> gc,
int x,
int y,
<a href="../../javax/print/PrintService.html" title="interface in javax.print">PrintService</a>[] services,
<a href="../../javax/print/PrintService.html" title="interface in javax.print">PrintService</a> defaultService,
<a href="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</a> flavor,
<a href="../../javax/print/attribute/PrintRequestAttributeSet.html" title="interface in javax.print.attribute">PrintRequestAttributeSet</a> attributes)
throws <a href="../../java/awt/HeadlessException.html" title="class in java.awt">HeadlessException</a></pre>
<div class="block">
<span>向用户呈现一个对话框,用于选择打印服务(打印机)。</span>
<span>它显示在应用程序指定的位置,并且是模态的。</span>
<span>如果规范无效或使对话框不可见,将显示在由实现确定的位置。</span>
<span>对话框阻止其调用线程,并且是应用程序模态。</span>
<p> <span>该对话框可能包括一个选项卡面板具有自定义UI当PrintService被浏览时它可以从PrintService的ServiceUIFactory中获取。</span> <span>该对话框将尝试首先找到一个MAIN_UIROLE作为JComponent然后作为Panel。</span> <span>如果没有ServiceUIFactory或没有匹配的角色则自定义选项卡将为空或不可见。</span> </p>
<p> <span>如果用户确定对话框对话框返回用户选择的打印服务如果用户取消对话框则该对话框返回null。</span> </p>
<p> <span>应用程序必须传递一组打印服务才能浏览。</span> <span>数组必须是非空值,非空值。</span> <span>通常应用程序将仅传递能够打印特定文档风格的PrintServices。</span> </p>
<p> <span>应用程序可能会传入PrintService以便初始显示。</span> <span>必须在可浏览服务数组中包含非空参数。</span> <span>如果此参数为空,则实现选择一个服务。</span> </p>
<p> <span>应用程序可以可选地传递要打印的风味。</span> <span>如果这是为用户提供的非空选项可以针对服务支持的那些更好地验证。</span> <span>应用程序必须传递PrintRequestAttributeSet以返回用户选择。</span> <span>调用PrintRequestAttributeSet可能为空或者可能包含应用程序指定的值。</span> </p>
<p> <span>这些用于设置初始显示的打印服务的初始设置。</span> <span>打印服务不支持的值将被忽略。</span> <span>当用户浏览打印服务时,属性和值将被复制到新显示。</span> <span>如果用户浏览不支持特定属性值的打印服务,则将该服务的默认值用作要复制的新值。</span> </p>
<p> <span>如果用户取消对话框,返回的属性将不会反映用户所做的任何更改。</span> <span>此方法的典型基本用法可能是:</span> </p>
<pre> <span><code> PrintService[] services = PrintServiceLookup.lookupPrintServices( DocFlavor.INPUT_STREAM.JPEG, null); PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); if (services.length &gt; 0) { PrintService service = ServiceUI.printDialog(null, 50, 50, services, services[0], null, attributes); if (service != null) { ... print ... } } </code></span> </pre>
<p></p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<span><code>gc</code> - 用于选择屏幕。</span>
<span>null表示主要或默认屏幕。</span>
</dd>
<dd>
<code>x</code> - 对话框的位置,包括屏幕坐标中的边框
</dd>
<dd>
<code>y</code> - 对话框的位置,包括屏幕坐标中的边框
</dd>
<dd>
<code>services</code> - 要浏览,必须为非空。
</dd>
<dd>
<code>defaultService</code> - - 要显示的初始PrintService。
</dd>
<dd>
<code>flavor</code> - - 要打印的味道,或无效。
</dd>
<dd>
<span><code>attributes</code> - 输入是初始应用程序提供的首选项。</span>
<span>这不能为空,但可能为空。</span>
<span>在输出时,属性反映用户所做的更改。</span>
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
用户选择的打印服务如果用户取消了对话框则为null。
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../java/awt/HeadlessException.html" title="class in java.awt">HeadlessException</a></code> - 如果GraphicsEnvironment.isHeadless返回true。
</dd>
<dd>
<code><a href="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</a></code> - if services is null or empty, or attributes is null, or the initial PrintService is not in the list of browsable services.
</dd>
</dl> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>