...

View Full Version : Need help with this Java



mex
08-28-2004, 08:04 AM
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/ASP/txtCodeId.2018/lngWId.2/qx/vb/scripts/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);
}
}


--------------------

jamescover
08-28-2004, 08:08 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum