2 Attachment(s)
Save java frame as pdf/image.
Hello everyone,
i made a small application/program in java like this using NETBEANS
Attachment 1476
iff u cant see the image properly herre is the link
http://i45.tinypic.com/314eds7.png
so what i want is when i click the save button in the below it should save the frame / the contents in the frame as same in picture shown as a PDF file or an image(.png/jpg/jpeg/.......) formats
and it should ask me in which directory it should save the file/image.
Using NetBeans
can anyone please help me ASAP
Thank you :)
Re: Save java frame as pdf/image.
What have you tried? Where are you stuck? I'd recommend a google search of something like "java paint to image" to get started.
Re: Save java frame as pdf/image.
Quote:
Originally Posted by
KevinWorkman
What have you tried? Where are you stuck? I'd recommend a google search of something like "java paint to image" to get started.
just check the url http://i45.tinypic.com/314eds7.png
I've tried in google but I dint get exactly as I want
there "1000 x" "500 x" are labels and in the textfields we hav to give inputs then it will multiply
and all the multiplied values are added when total button is pressed
so what I want is when I press the save button in the bottom then it should take screenshot same as the image/pic I've given(URL) and it should save as a pdf file or an image
Re: Save java frame as pdf/image.
Right. What have you done code-wise to paint your components to an image? What did you find in google? Because when I performed the search, I found several links. I figured your google-fu was just as good as mine though.
If you're confused about something, I recommend you create an SSCCE that tries to draw a single component (say, a JButton) to an image instead of your entire gui.
Re: Save java frame as pdf/image.
Quote:
can anyone please help me ASAP
This actually causes your help to slow down. First, it wastes everyone's time to read it, slowing them down. Then someone has to tell you it is considered rude, not just on a forum but in life, to demand help, and/or to demand help asap. Then people waste even more time reading this post, and by the time it is all over, collectively, more than an hour of human life was wasted because you said you were in a hurry. Try to relax friend, I read every post on this forum every day, and not one time did i know someone wrote "hurry", "now", "important", "homework due", or "asap" until I was here to read it. (myself and many others I might add) You rob yourself an hour of manpower!
Re: Save java frame as pdf/image.
Well since there are a lot of parts to your question, I'll break down a few of the terms you should use in your Google search:
Java Robot Class - For taking pixel data from the screen.
Creating a Bitmap - For turning the pixel data into an image that (Insert program here) can recognize.
JTree/Directory Tree/File System Tree - For a "Save as..." Function.
Happy programming,
Donny.
Re: Save java frame as pdf/image.
You could use the Robot class, or you could also pass the Graphics of a BufferedImage into your component's paint or paintComponent() method.