• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to print a jframe ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a requirement , which is exact like a form on the internet , in that you fill the form and you get a printable form but , this is for desktop app
i have a fully designed app or jframe which accepts certain input , gives appropriate output , but the problem is
this frame is designed with company logo on a jlabel and also has a jtable for my requirement,
i can pull the value from jtable and store it in a excel file and can print that excel file using Desktop class
but what about images on the frame , how to print that images or copy that images in excel file ?
does any one have ever find urself in such a situation ?
 
Randall Twede
Ranch Hand
Posts: 4520
6
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
someone turned me on to this class that might help. it will save your JFrame to an image file.

http://tips4java.wordpress.com/2008/10/13/screen-image/
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is right there in the Oracle tutorial: Lesson: Printing.

For future reference, if you want to learn how to do X in Java then your google keywords are "java X tutorial". Select the tutorial from download.oracle.com from that list in preference to others.
 
Randall Twede
Ranch Hand
Posts: 4520
6
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
good advice. i do exactly that all the time
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or bookmark this webpage.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer this. It requires a bit more work to go directly to a tutorial page, but I think it's easier to find what you're looking fore because you don't need to go through the entire list.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!