Click to See Complete Forum and Search --> : Java paint/trace question
buildakicker
10-23-2006, 12:36 PM
hello all,
Great forum here! I have been working on a project that I think I need Java for. I am very new to Java, but I don't think this would be hard.
What I would like to do is have a "paint" environment similar to Java Paint Brush (http://www.partow.net/projects/jpaintbrush/index.html) where I can load a selected PDF map into the background, then trace a route I like, then save the entire file as a new PDF with the traced area included.
Is this something easy or should I be going about it some different way???
Any suggestions would be great!
agent_x91
10-30-2006, 04:20 AM
If you're very new to Java, this may be a difficult project for you.
It involves using mouse listeners to check when the mouse is moved, clicked, dragged, etc. and to act according, dynamically creating the appropriate lines. This may be difficult for a beginner.
Also, saving it in PDF format may cause a problem; I've never done this myself and I'm not sure how simple it is made in Java. I believe there is a class which will help handle it, however.
Sorry if I misunderstood what you're attempting to do, I couldn't get onto the website you listed so I couldn't see the example. It just occured to me that I may have got the wrong end of the stick. Are you planning on making a graphics editor or something relatively simpler?
buildakicker
10-30-2006, 07:01 PM
Hi,
Thanks for the response. Yes, you hit it. I would like to open a PDF file into a Java paint program, do some simple highlight or circle, save and send file to somewhere over the net.
Any clues? Is this all in writing my own functions?
I will learn.
agent_x91
11-01-2006, 05:52 AM
You may wish to use a JLabel object to hold the image: loading/saving PDFs may be somewhat difficult, but the general theory would be to load the PDF into a BufferedImage or similar object, and use this as the icon for the JLabel, displaying the image you've loaded on the background. Then you'd use mouse listeners to detect when you've clicked, dragged, etc., and apply the appropriate changes to the BufferedImage using the various methods of Graphics.
It's likely to be fairly complicated for a beginner, especially when taking into consideration the fact that you will probably also want a colour panel to select colours, etc.