Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Need help with this Java

    I'm not a java programmer and so i couldn't really understand the working of this script!! Can anyone help me out and if u kindly send me the working version in .zip or whatever format to mex_young@yahoo.com , I'll be thankful. Thanx

    -----------------
    //**************************************
    // Name: Screen Capture in JAVA
    // Description:This code allows you to perform a screen capture on any OS using Java 1.3 or higher. UPDATED: now determines the screen size from the toolkit and captures the whole screen.
    // By:
    //
    //
    // Inputs:None
    //
    // Returns:None
    //
    //Assumes:None
    //
    //Side Effects:None
    //This code is copyrighted and has limited warranties.
    //Please see http://www.Planet-Source-Code.com/xq...s/ShowCode.htm
    //for details.
    //**************************************

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import javax.swing.*;
    import java.awt.Robot;
    public class CaptureScreenFrame extends JFrame


    {
    BufferedImage img = null;
    Robot r = null;
    Toolkit ct = null;
    public CaptureScreenFrame()


    {
    getContentPane().setLayout(null);
    try {
    r = new Robot();
    ct = Toolkit.getDefaultToolkit();
    } catch (AWTException ex) {
    System.out.println(ex);
    }
    JButton button = new JButton("Capture");
    button.setBounds(10,10,100,25);
    button.addActionListener
    (
    new ActionListener()


    {
    public void actionPerformed(ActionEvent e)


    {
    img = r.createScreenCapture(new Rectangle(10,10,(int)ct.getScreenSize().getWidth(),(int)ct.getScreenSize().getHeight()));
    repaint();
    }
    }
    );
    getContentPane().add(button);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e)


    {
    System.exit(0);
    }
    });
    }
    public void paint(Graphics g)


    {
    super.paint(g);
    if (img != null)
    g.drawImage(img,10,70,(int)ct.getScreenSize().getWidth(),(int)ct.getScreenSize().getHeight(),this);
    }
    public static void main(String argv[])


    {
    CaptureScreenFrame frame = new CaptureScreenFrame();
    frame.setBounds(50,50,300,300);
    frame.setVisible(true);
    }
    }


    --------------------
    Wonder

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not a java programmer
    This is a javascript, not java, forum.


    Can anyone help me out and if u kindly send me the working version in .zip or whatever format to mex_young@yahoo.com , I'll be thankful. Thanx
    I don't think you'll get many responses with that type of request...unless you're offering monetary compensation.



    -james
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "


  •  

    Posting Permissions

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