Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Saving image at runtime

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am generating some graph in Applet mainly using drawLine() and drawOval() methods and now wanted to save the graph ( which I can view from appletviewer )as image(.bmp or jpeg format).
I realy don't have clue about this. Does anybody knows?
-
padmashree
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, you should double-buffer your drawing. That is, do all of your drawing into an Image object and then paint that Image.
Second, get the JPEG Encoder from Obrador: http://www.obrador.com/essentialjpeg/jpeg.htm
Third, you can use something like the following method to write the Image as a JPEG to an OutputStream:

Of course, getting permission to create a file from an applet is a whole other can of worms....
 
padma patil
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I am using JpegEncoder to save image. it works.
I have used policy file to grant File access to Applet.
I have posted another question for "loading policy file from Applet"

Let me know your feedback
-
padmashree
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic