Java Reference
In-Depth Information
L ISTING 11.9 Continued
import javax.jnlp.*;
import java.awt.*;
* Chapter 11 - An example of printing via JNLP API
* @author Mauro Marinilli
* @version 1.0
public class PrintServiceExample {
public PrintServiceExample() {
PrintService ps =
ps.print(new PrintableExample());
public class PrintableExample implements Printable {
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex){
Graphics2D g2d = (Graphics2D)graphics;
g2d.drawString(“A JNLP Print”,100,100);
public static void main(String[] args) {
PrintServiceExample printServiceExample1 = new PrintServiceExample();
An Example Application
As a recapping example of what said, let's take a look at Listing 11.10, in which an application
uses many of the things discussed in this chapter. As we can see, we are constantly moving
toward a full-fledged application, such as the one presented in Chapter 13.
L ISTING 11.10 A Recapping Example of JNLP Runtime Services at Work
package com.marinilli.b2.c11;
import com.marinilli.b2.c11.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.jnlp.*;
import java.util.Iterator;
Search WWH ::

Custom Search