• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Saving of freehand drawing coordination...

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Do anyone of you have any idea how can i save my X and Y value coordination in a text file? I am currently doing a freehand drawing. i need to know how to save the coordination when i draw.

For example when i draw from point A to Point B, the moment i click on my mouse, it should be able to capture the coordination i am at and when i started to drag, every drag i do, automatically it capture the coordination and save it into a file. This process repeats until i stop drawing.

I will be required to have a save button to save my drawing and load it as when i want it. is there anyway i can do that??? Please enlighten me!!!

Thank You!!
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. use a bufferedimage
2. take its graphics object and draw the freehand on that grahics (g.drawLine...)
3. use imageIO in java 1.4.2 to save it JPG format and you can load that image.
4. however if you want to save only the coordinates, then first collect the coordinates in a Vector orany collection class. then save the Vector maybe using serialization, or you can use a simple text file to save the coordinates. To load the image, you can read the coordinates from the file and draw the lines accordingly.
 
MJ Seah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thanks for the reply...

I would like to save just the coordinates...

do u have a set of coding for me to refer to? Thank you... waiting for your reply again...
 
She'll be back. I'm just gonna wait here. With this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic