aspose file tools*
The moose likes Applets and the fly likes applet x/y coordinates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "applet x/y coordinates" Watch "applet x/y coordinates" New topic
Author

applet x/y coordinates

john s murray
Ranch Hand

Joined: Apr 26, 2009
Posts: 30
Hi, newbie to applets. Apologize in advance. I have an applet that does the basic drawing. I'm able to get the x/y coordinates. How do I get this into a BufferedImage and convert into a TIFF file. I noticed ImageIO doesn't support TIFF so my options are JAI.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

You want to get x-y coordinates into a BufferedImage? Sorry, I can't really tell what you mean by that.
john s murray
Ranch Hand

Joined: Apr 26, 2009
Posts: 30
When drawing, I get a string of x and y coordinates. How can I take these coordinates and draw them out and save as an image. I can write a servlet to take the string. Just need to know how to repaint and save that image.
john s murray
Ranch Hand

Joined: Apr 26, 2009
Posts: 30
another thought. is there a way to just get what is current drawn on the canvas and save it as an image?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

Sorry, I still don't understand what it means to "draw out" a set of coordinates. But let's suppose that whatever that means, you can get a JPanel to display whatever it is. Then here's some code I have which converts that JPanel to a graphics file (a GIF as it happens but there are other options):
john s murray
Ranch Hand

Joined: Apr 26, 2009
Posts: 30
Thanks for the reply Paul. However, you did provide some some info. However, I'm using applets. When using applets, it's using the Canvas and drawing using the mouseEvent is collected with the double xy coordinates. What's strange is that there's no info to be found on the web on how to save that canvas drawing into a jpeg, gif, or even a tiff. Any other help would be greatly appreciated.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42632
    
  65
john s murray wrote:How do I get this into a BufferedImage and convert into a TIFF file. I noticed ImageIO doesn't support TIFF so my options are JAI.

TIFF support for ImageIO is easy to enable: http://www.coderanch.com/t/445956/open-source/add-tiff-writer-imageio-package


Ping & DNS - my free Android networking tools app
john s murray
Ranch Hand

Joined: Apr 26, 2009
Posts: 30
thanks for all the input. after some testing, i was able to get it working.
 
 
subject: applet x/y coordinates