Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2011
    Posts
    37
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question How to print a window in java

    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?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Awesome, oracle has a tutorial for this here: http://docs.oracle.com/javase/tutori...ing/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).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •