PrintJobEvent (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.print.event, class: PrintJobEvent
Keywords: javax.print.event.PrintJobEvent class

# Class PrintJobEvent

java.lang.Object
java.util.EventObject
javax.print.event.PrintEvent
javax.print.event.PrintJobEvent

All Implemented Interfaces:
  `Serializable`

public class PrintJobEvent extends PrintEvent
Class `PrintJobEvent` encapsulates common events a print job reports to let a listener know of progress in the processing of the `DocPrintJob`.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DATA_TRANSFER_COMPLETE`
  The job is not necessarily printed yet, but the data has been transferred successfully from the client to the print service.
  `static final int`
  `JOB_CANCELED`
  The job was canceled by the `PrintService`.
  `static final int`
  `JOB_COMPLETE`
  The document is completely printed.
  `static final int`
  `JOB_FAILED`
  The print service reports that the job cannot be completed.
  `static final int`
  `NO_MORE_EVENTS`
  Not all print services may be capable of delivering interesting events, or even telling when a job is complete.
  `static final int`
  `REQUIRES_ATTENTION`
  The print service indicates that a - possibly transient - problem may require external intervention before the print service can continue.

  ### Fields declared in class EventObject

  `source`
  Modifier and Type
  Field
  Description
  `protected Object`
  `source`
  The object on which the Event initially occurred.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PrintJobEvent(DocPrintJob source, int reason)`
  Constructs a `PrintJobEvent` object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getPrintEventType()`
  Gets the reason for this event.
  `DocPrintJob`
  `getPrintJob()`
  Determines the `DocPrintJob` to which this print job event pertains.

  ### Methods declared in class PrintEvent

  `toString`
  Modifier and Type
  Method
  Description
  `String`
  `toString()`
  Returns a string representation of this `PrintEvent`.

  ### Methods declared in class EventObject

  `getSource`
  Modifier and Type
  Method
  Description
  `Object`
  `getSource()`
  The object on which the Event initially occurred.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Field Details

  - ### JOB_CANCELED

    public static final int JOB_CANCELED
    The job was canceled by the `PrintService`.
    See Also:
      - Constant Field Values

  - ### JOB_COMPLETE

    public static final int JOB_COMPLETE
    The document is completely printed.
    See Also:
      - Constant Field Values

  - ### JOB_FAILED

    public static final int JOB_FAILED
    The print service reports that the job cannot be completed. The application must resubmit the job.
    See Also:
      - Constant Field Values

  - ### REQUIRES_ATTENTION

    public static final int REQUIRES_ATTENTION
    The print service indicates that a - possibly transient - problem may require external intervention before the print service can continue. One example of an event that can generate this message is when the printer runs out of paper.
    See Also:
      - Constant Field Values

  - ### NO_MORE_EVENTS

    public static final int NO_MORE_EVENTS
    Not all print services may be capable of delivering interesting events, or even telling when a job is complete. This message indicates the print job has no further information or communication with the print service. This message should always be delivered if a terminal event (completed/failed/canceled) is not delivered. For example, if messages such as `JOB_COMPLETE` have NOT been received before receiving this message, the only inference that should be drawn is that the print service does not support delivering such an event.
    See Also:
      - Constant Field Values

  - ### DATA_TRANSFER_COMPLETE

    public static final int DATA_TRANSFER_COMPLETE
    The job is not necessarily printed yet, but the data has been transferred successfully from the client to the print service. The client may free data resources.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### PrintJobEvent

    public PrintJobEvent(DocPrintJob source, int reason)
    Constructs a `PrintJobEvent` object.
    Parameters:
      `source` - a `DocPrintJob` object
      `reason` - an int specifying the reason
    Throws:
      `IllegalArgumentException` - if `source` is `null`

- ## Method Details

  - ### getPrintEventType

    public int getPrintEventType()
    Gets the reason for this event.
    Returns:
      reason int

  - ### getPrintJob

    public DocPrintJob getPrintJob()
    Determines the `DocPrintJob` to which this print job event pertains.
    Returns:
      the `DocPrintJob` object that represents the print job that reports the events encapsulated by this `PrintJobEvent`