Java examples for 2D Graphics:Print
print Component
import java.awt.*; import javax.swing.*; import java.awt.print.*; import java.util.ArrayList; import java.util.StringTokenizer; public class Main{ public static void printComponent(Component c) throws PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new ComponentPrinter(c)); if (job.printDialog()) job.print();/*from w w w.j a va2 s . c om*/ } }