⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printerjob.java

📁 JAVA基本类源代码,大家可以学习学习!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * <p>     * As the user scrolls to a new print service selection, the values     * copied are based on the settings for the previous service, together     * with any user changes. The values are not based on the original     * settings supplied by the client.     * <p>     * With the exception of selected printer, the PrinterJob state is     * not updated to reflect the user's changes.     * For the selections to affect a printer job, the attributes must     * be specified in the call to the     * <code>print(PrintRequestAttributeSet)</code> method. If using     * the Pageable interface, clients which intend to use media selected     * by the user must create a PageFormat derived from the user's     * selections.     * If the user cancels the dialog, the attributes will not reflect     * any changes made by the user.     * @param attributes on input is application supplied attributes,     * on output the contents are updated to reflect user choices.     * This parameter may not be null.     * @return <code>true</code> if the user does not cancel the dialog;     * <code>false</code> otherwise.     * @exception HeadlessException if GraphicsEnvironment.isHeadless()     * returns true.     * @exception NullPointerException if <code>attributes</code> parameter     * is null.     * @see java.awt.GraphicsEnvironment#isHeadless     * @since     1.4     *      */    public boolean printDialog(PrintRequestAttributeSet attributes)	throws HeadlessException {	if (attributes == null) {	    throw new NullPointerException("attributes");	}	return printDialog();    }    /**     * Displays a dialog that allows modification of a     * <code>PageFormat</code> instance.     * The <code>page</code> argument is used to initialize controls     * in the page setup dialog.     * If the user cancels the dialog then this method returns the     * original <code>page</code> object unmodified.     * If the user okays the dialog then this method returns a new     * <code>PageFormat</code> object with the indicated changes.     * In either case, the original <code>page</code> object is     * not modified.     * @param page the default <code>PageFormat</code> presented to the     *			user for modification     * @return    the original <code>page</code> object if the dialog     *            is cancelled; a new <code>PageFormat</code> object     *		  containing the format indicated by the user if the     *		  dialog is acknowledged.     * @exception HeadlessException if GraphicsEnvironment.isHeadless()     * returns true.     * @see java.awt.GraphicsEnvironment#isHeadless     * @since     1.2     */    public abstract PageFormat pageDialog(PageFormat page)        throws HeadlessException;    /**     * A convenience method which displays a cross-platform page setup dialog.     * The choices available will reflect the print service currently     * set on this PrinterJob.     * <p>     * The attributes parameter on input will reflect the client's     * required initial selections in the user dialog. Attributes which are     * not specified display using the default for the service. On return it     * will reflect the user's choices. Selections may be updated by     * the implementation to be consistent with the supported values     * for the currently selected print service.     * <p>     * The return value will be a PageFormat equivalent to the     * selections in the PrintRequestAttributeSet.     * If the user cancels the dialog, the attributes will not reflect     * any changes made by the user, and the return value will be null.     * @param attributes on input is application supplied attributes,     * on output the contents are updated to reflect user choices.     * This parameter may not be null.     * @return a page format if the user does not cancel the dialog;     * <code>null</code> otherwise.     * @exception HeadlessException if GraphicsEnvironment.isHeadless()     * returns true.     * @exception NullPointerException if <code>attributes</code> parameter     * is null.     * @see java.awt.GraphicsEnvironment#isHeadless     * @since     1.4     *      */    public PageFormat pageDialog(PrintRequestAttributeSet attributes)        throws HeadlessException {	if (attributes == null) {	    throw new NullPointerException("attributes");	}	return pageDialog(defaultPage());    }    /**     * Clones the <code>PageFormat</code> argument and alters the     * clone to describe a default page size and orientation.     * @param page the <code>PageFormat</code> to be cloned and altered     * @return clone of <code>page</code>, altered to describe a default     *                      <code>PageFormat</code>.     */    public abstract PageFormat defaultPage(PageFormat page);    /**     * Creates a new <code>PageFormat</code> instance and     * sets it to a default size and orientation.     * @return a <code>PageFormat</code> set to a default size and     *		orientation.     */    public PageFormat defaultPage() {        return defaultPage(new PageFormat());    }    /**     * Returns the clone of <code>page</code> with its settings     * adjusted to be compatible with the current printer of this     * <code>PrinterJob</code>.  For example, the returned      * <code>PageFormat</code> could have its imageable area      * adjusted to fit within the physical area of the paper that     * is used by the current printer.     * @param page the <code>PageFormat</code> that is cloned and      *		whose settings are changed to be compatible with     *		the current printer     * @return a <code>PageFormat</code> that is cloned from     *		<code>page</code> and whose settings are changed      *		to conform with this <code>PrinterJob</code>.     */    public abstract PageFormat validatePage(PageFormat page);    /**     * Prints a set of pages.     * @exception PrinterException an error in the print system     *            caused the job to be aborted.     * @see Book     * @see Pageable     * @see Printable     */    public abstract void print() throws PrinterException;   /**     * Prints a set of pages using the settings in the attribute     * set. The default implementation ignores the attribute set.     * <p>     * Note that some attributes may be set directly on the PrinterJob     * by equivalent method calls, (for example), copies:     * <code>setcopies(int)</code>, job name: <code>setJobName(String)</code>     * and specifying media size and orientation though the     * <code>PageFormat</code> object.     * <p>     * If a supported attribute-value is specified in this attribute set,     * it will take precedence over the API settings for this print()     * operation only.     * The following behaviour is specified for PageFormat:     * If a client uses the Printable interface, then the     * <code>attributes</code> parameter to this method is examined     * for attributes which specify media (by size), orientation, and     * imageable area, and those are used to construct a new PageFormat     * which is passed to the Printable object's print() method.     * For clients of the Pageable interface, the PageFormat will always     * be as supplied by that interface, on a per page basis.     * <p>     * These behaviours allow an application to directly pass the     * user settings returned from     * <code>printDialog(PrintRequestAttributeSet attributes</code> to     * this print() method.     * <p>     *      * @param attributes a set of attributes for the job     * @exception PrinterException an error in the print system     *            caused the job to be aborted.     * @see Book     * @see Pageable     * @see Printable     */    public void print(PrintRequestAttributeSet attributes)	throws PrinterException {	print();    }    /**     * Sets the number of copies to be printed.     * @param copies the number of copies to be printed     * @see #getCopies     */    public abstract void setCopies(int copies);    /**     * Gets the number of copies to be printed.     * @return the number of copies to be printed.     * @see #setCopies     */    public abstract int getCopies();    /**     * Gets the name of the printing user.     * @return the name of the printing user     */    public abstract String getUserName();    /**     * Sets the name of the document to be printed.     * The document name can not be <code>null</code>.     * @param jobName the name of the document to be printed     * @see #getJobName     */    public abstract void setJobName(String jobName);    /**     * Gets the name of the document to be printed.     * @return the name of the document to be printed.     * @see #setJobName     */    public abstract String getJobName();    /**     * Cancels a print job that is in progress.  If      * {@link #print() print} has been called but has not      * returned then this method signals     * that the job should be cancelled at the next     * chance. If there is no print job in progress then     * this call does nothing.     */    public abstract void cancel();    /**     * Returns <code>true</code> if a print job is      * in progress, but is going to be cancelled     * at the next opportunity; otherwise returns     * <code>false</code>.     * @return <code>true</code> if the job in progress     * is going to be cancelled; <code>false</code> otherwise.     */    public abstract boolean isCancelled();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -