View Full Version : How to print a window in java

01-26-2012, 05:21 PM
Hi Friends!

I have been struggling to print out a receipt from my java application.

Please can anybody help me with the code to print my JFrame by clicking the print button?

01-26-2012, 06:28 PM
Awesome, oracle has a tutorial for this here: http://docs.oracle.com/javase/tutorial/2d/printing/index.html
I'd suggest you make use of the javax.print and not the java.awt.print since you are using swing.
Follow the whole tutorial, and you should get exactly what you are looking for (and a lot of experience with Graphics class if you're weak with that like I am).