Results 1 to 2 of 2
  1. #1
    inash is offline Member
    Join Date
    Mar 2011
    Rep Power

    Question Capturing Applet as an image

    Hello All
    I am a new bie to java.I have created an applet(like a drawing area/writing area) using Swings.i created a jar for that and called that jar in html,and i am getting the applet in html.
    i have web server running on my the html page, it has my applet and a html save button.
    my question is if i draw or write something in my applet and when i click the save button,it(applet) should be captured and saved as an image.
    how can i do that?

    Thanks in advance

  2. #2
    Dinesh_rockz is offline Member
    Join Date
    Jan 2011
    Rep Power


    by using java.awt.Robot class we get screen capture..
    try the following code..!
    Java Code:
    try {
     Image cap_img;
            Robot rbt = new Robot( );
            Dimension dime = Toolkit.getDefaultToolkit().getScreenSize();
           cap_img = rbt.createScreenCapture(new Rectangle(dime));
         //You Can Draw the cpa_img any where...!
        } catch (Exception ex) {
            ex.printStackTrace( );
    i hope it was helpful for you..! :)

Similar Threads

  1. Replies: 0
    Last Post: 07-01-2010, 03:56 PM
  2. capturing image
    By java_bond in forum Advanced Java
    Replies: 5
    Last Post: 03-04-2010, 07:45 AM
  3. Replies: 0
    Last Post: 11-20-2008, 11:03 AM
  4. Image upload applet 2.0
    By jfileupload in forum Java Software
    Replies: 0
    Last Post: 03-24-2008, 04:15 PM
  5. how to place an image in an applet
    By paty in forum Java Applets
    Replies: 2
    Last Post: 08-04-2007, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts