Home » Desktop Java » Page 31

Desktop Java

Print to file with Java

In this example we are going to see how to print a document to a .ps file in Java. This is very useful when you want to create simple and easy previews of the print that the user might perform. In order to print to a file, one should follow these steps: Open a new pdf file to print using BufferedInputStream(new ...

Read More »

Get print service attributes

This is an example on how to get print service attributes in a Java Desktop Application. This is very useful when you want to list these attributes to inform the user about the properties of his print. In short, to get print service attributes one should follow these steps: Use PrintServiceLookup.lookupDefaultPrintService() to locate the default print service for this environment. Use service.getAttributes().toArray() ...

Read More »

Use streaming printing service in Java

In this example we are going to see how to use streaming printing services in a Java Desktop Application. This is very useful when you want to handle print jobs inside your application. It’s very easy to use streaming printing services in Java. All you have to do is: Open an image using new BufferedInputStream(new FileInputStream("myfile.gif")). Prepare the output file ...

Read More »

Cancel print job

This is an example that demonstrates how to cancel print jobs in a Java Desktop Application. This is a very basic step you have to consider when you have to develop error handling procedures for your applications. In short, all you have to do to cancel print jobs is: Open a pdf file you want to print. Create a PDF ...

Read More »

Determine that print job has finished

With this example we are going to see how we can determine that a print job has finished. It’s very easy to do that, as you only have to : Open a pdf file to print. Create a new PrintService. Create a new DocPrintJob. Create a class that extends PrintJobAdapter. Override printJobCanceled, printJobCompleted, printJobFailed, printJobNoMoreEvents to monitor the status of ...

Read More »

Handle print job events

With this tutorial we shall show you how to handle print job events in a Java Desktop Application. This is a very important step to consider when you handle many print jobs in your application an you want to monitor their status as well as inform the user for the progress of his print jobs. Basically, all you have to ...

Read More »

Use Printing Service in Java

In this example we are going to see how to use streaming printing services in a Java Desktop Application. This is very usefull when you wanto to handle print jobs inside your application. It’s very easy to use streaming printing services in Java. All you have to do is: Open a pdf file using new BufferedInputStream(new FileInputStream("myfile.pdf")). Create a PDF DocFlavor. ...

Read More »

Discover Streaming Print Services

With this example we shall show you how to discover streaming print services in a Java Desktop Application. You will find this particularly useful when you want to create and handle print jobs from you application. Discovering streaming print services is very easy as it requires that you : Use StreamPrintServiceFactory.lookupStreamPrintServiceFactories(null, null) to locates factories for print services that can ...

Read More »

Discover Print Services

With this example we shall show you how to discover print services in a Java Desktop Application. You will find this particularly useful when you want to create and handle print jobs from you application. Discovering streaming print services is very easy as it requires that you : Use PrintServiceLookup.lookupPrintServices to locates factories for print services that can be used with ...

Read More »

Handle sampled audio playing events

In this tutorial we are going to see how to handle sampled audio playing events.This is a very important task if you plan to create a small media player in your app. Handling samples audio events will help you monitor the progress of the audio playing and inform the user for any mistakes or errors. In short, in order to ...

Read More »