Screen capture in Java 1.1

I am programming an application that needs to be in Java 1.1, and I want to capture the screen client area into an Image object. I can't find how to do it. Does anyone know how to do that?

I am curious about this also.

Similar Messages

  • Screen capture in java ?

    i want to capture a Screen in java and save it as a video file now.
    later i want to make like video streaming software for lan or wan.
    means
    any one can see what going on that pc where this Screen capture java software was installed.
    so any help regarding this problem ?
    i want to make a software like www.gotomeeting.com
    Edited by: myharshdesigner on Dec 1, 2007 11:44 AM

    So what have you done so far and where are you stuck?
    See
    {color:0000ff}http://catb.org/~esr/faqs/smart-questions.html
    mindprod.com/jgloss/sscce.html
    http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
    http://www.codebeach.com/tutorials/screenshots-java.asp
    https://aptframework.dev.java.net/gooey/screenCapture.html{color}
    db

  • Fascinating automated screen capture tool

    Hello Java Experts
    THE SITUATION
    ============
    At least 4 times a year, I get email advertising where they seem to do a screen capture on the home page of my web site, scale it down to 20%, insert it into a template and send it to me.
    I guess they are getting all URLs from a domain registry crawl.
    then they send out a web crawler that does an automated screen capture.
    QUESTION
    =========
    I'm really curious to know how to do such an automated screen capture with java.
    If anyone has any idea how to implement such a solution , I would be glad to hear it.
    I know java can be programmed to download all the HTML Code and even the gif/jpg files of the <img/> tags.
    but how would you automatically, capture and scale it down to about 20% of the original size and save it.
    Stev

    you said "I'm guessing java wouldn't be the best way to go. "
    I'm under the impression that java can do everything. The trick might be to find out how to do it.
    I
    'll propose one really bad and slow way to do it.
    There is already a swing component that will translate HTML code (that was gathered) into the actual web page.
    Now I believe there is a Robot API that will perform clicks of the keyboard and mouse and simulate an actual user at the computer.
    In this case , you could make it simulate the buttons to do a print screen .
    You could use the robot API to make it paste the result some place and do whatever transformations and saving of the object needed.
    I realize this is a bad way to do it because it is so slow. But it is automated.
    However I am under the impression there is a way to do this effectively and very fast with java.
    I'm guessing it would be using the new nio package in java 1.4
    stephen

  • Query regarding screen capture in webdynpro

    Hi
    i needed to use the java.awt.Robot class to perform a screen capture. This is basically used to capture signature which is done on a applet. But hwile i am using it gives me java.awt.headless exception which basically means that i cannot use display devices or certain other features. is there any way get past this.
    Is there any way i can do a screen capture using webdynpro.
    I have few more doubts regarding a application that i need to make. If i am not able to get a solution for this problem i would explain the scenario and probably someone could help me with solution for the same
    thanks
    regards
    Srikumar V

    The problem is that the iframe control is not really supported and should not be used anymore i think.
    But anyways: Since there is actually no out of the box solution, the steps you would hav to go are as follows:
    1. Get Access to the image data (client side)
    I suppose the paint method of one of the AWT/Swing components is overwritten to draw the signature with a pointig device (eg mouse/touch screen)
    in the method public void paint(Graphics g) you have access to the component's Graphics object.
    When the user presses a button in that applet you need to get the latest graphics object of the component and get the bitmap data out of it.
    This is basically the same as using the java robot screenshot, just more elegant.
    But it is important of course, that the navigation to the new view is somehow triggered by the applet so that it can send the request to the servlet before the applet is destroyed.
    2. Send the data to the Server
    I think the best would be to write a servlet to accept the bitmap data from the applet and store it to a database. When the File is uploaded you have to navigate to the next view (using portal navigation or javascript to reload the parent frame)
    Then you need to query that database from Webdynpro to get the file.
    3. Now you would have to use a library like iText to create a PDF file with your image in it.
    This is all not really easy and I can only describe some rough ideas. I cannot think of an easier way to do it right now since client side coding is not supported by webdynpro.

  • Robot screen capture problem on Mac os 10

    Dear all,
    I perform a screen capture with jframe size.The background capture is ok but i have a line border around the rectangle determined by the capture and a shadow in capture background..
    How to remove the line border of capture, and suppress the shadow on mac ....
    Thanks in advance for all helps..
    package nomadsland.splashWindow;
    import java.awt.AWTException;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.Robot;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import java.awt.image.ConvolveOp;
    import java.awt.image.Kernel;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JWindow;
    import javax.swing.Timer;
    public class ShadowedWindow extends JWindow {
        private BufferedImage splash = null;
        public ShadowedWindow(BufferedImage image) {
            createShadowPicture(image);
        public void paint(Graphics g) {
            if (splash != null) {
                g.drawImage(splash, 0, 0, null);
        private void createShadowPicture(BufferedImage image) {
            int width = image.getWidth();
            int height = image.getHeight();
            int extra = 14;
            setSize(new Dimension(width + extra, height + extra));
            setLocationRelativeTo(null);
            Rectangle windowRect = getBounds();
            splash = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = (Graphics2D) splash.getGraphics();
            try {
                Robot robot = new Robot(getGraphicsConfiguration().getDevice());
                BufferedImage capture = robot.createScreenCapture(new Rectangle(windowRect.x, windowRect.y, windowRect.width + extra, windowRect.height + extra));
                g2.drawImage(capture, null, 0, 0);
            } catch (AWTException e) { }
            BufferedImage shadow = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB);
            Graphics g = shadow.getGraphics();
            g.setColor(new Color(0.0f, 0.0f, 0.0f, 0.3f));
            g.fillRoundRect(6, 6, width, height, 12, 12);
            g2.drawImage(shadow, getBlurOp(7), 0, 0);
            g2.drawImage(image, 0, 0, this);
        private ConvolveOp getBlurOp(int size) {
            float[] data = new float[size * size];
            float value = 1 / (float) (size * size);
            for (int i = 0; i < data.length; i++) {
                data[i] = value;
            return new ConvolveOp(new Kernel(size, size, data));
        public static void main(String[] args) {
            try {
                 BufferedImage image = ImageIO.read(ShadowedWindow.class.getResourceAsStream("loginPanelGeneric.png"));
                ShadowedWindow window = new ShadowedWindow(image);
                window.setVisible(true);
                Timer timer = new Timer(5000, new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        System.exit(0);
                timer.start();
            } catch (IOException e) {
                e.printStackTrace();
    }Thanks you in advance for any help...

    Dear all,
    I perform a screen capture with jframe size.The background capture is ok but i have a line border around the rectangle determined by the capture and a shadow in capture background..
    How to remove the line border of capture, and suppress the shadow on mac ....
    Thanks in advance for all helps..
    package nomadsland.splashWindow;
    import java.awt.AWTException;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.Robot;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import java.awt.image.ConvolveOp;
    import java.awt.image.Kernel;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JWindow;
    import javax.swing.Timer;
    public class ShadowedWindow extends JWindow {
        private BufferedImage splash = null;
        public ShadowedWindow(BufferedImage image) {
            createShadowPicture(image);
        public void paint(Graphics g) {
            if (splash != null) {
                g.drawImage(splash, 0, 0, null);
        private void createShadowPicture(BufferedImage image) {
            int width = image.getWidth();
            int height = image.getHeight();
            int extra = 14;
            setSize(new Dimension(width + extra, height + extra));
            setLocationRelativeTo(null);
            Rectangle windowRect = getBounds();
            splash = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = (Graphics2D) splash.getGraphics();
            try {
                Robot robot = new Robot(getGraphicsConfiguration().getDevice());
                BufferedImage capture = robot.createScreenCapture(new Rectangle(windowRect.x, windowRect.y, windowRect.width + extra, windowRect.height + extra));
                g2.drawImage(capture, null, 0, 0);
            } catch (AWTException e) { }
            BufferedImage shadow = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB);
            Graphics g = shadow.getGraphics();
            g.setColor(new Color(0.0f, 0.0f, 0.0f, 0.3f));
            g.fillRoundRect(6, 6, width, height, 12, 12);
            g2.drawImage(shadow, getBlurOp(7), 0, 0);
            g2.drawImage(image, 0, 0, this);
        private ConvolveOp getBlurOp(int size) {
            float[] data = new float[size * size];
            float value = 1 / (float) (size * size);
            for (int i = 0; i < data.length; i++) {
                data[i] = value;
            return new ConvolveOp(new Kernel(size, size, data));
        public static void main(String[] args) {
            try {
                 BufferedImage image = ImageIO.read(ShadowedWindow.class.getResourceAsStream("loginPanelGeneric.png"));
                ShadowedWindow window = new ShadowedWindow(image);
                window.setVisible(true);
                Timer timer = new Timer(5000, new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        System.exit(0);
                timer.start();
            } catch (IOException e) {
                e.printStackTrace();
    }Thanks you in advance for any help...

  • Robot Class (Screen Capture)

    Hello friends,
    i have a problem and i don't know if it's a bug or something wrong with my code i just developed this code below to create a screencapture application and i do get the screen capture in the jpeg format but the problem is that i don't see the mouse pointer in the screenshot that i get why don't i see the mouse pointer when i can see everthing else
    import java.awt.*;
    import java.awt.Image.*;
    import javax.imageio.*;
    import java.io.*;
    public class test{
    public static void main(String args[]){
    try{
    Robot tt=new Robot();
    Rectangle screen=new Rectangle(1024,768);
    File f1 = new File("/home/hari/java/test.jpg");
    javax.imageio.ImageIO.write(tt.createScreenCapture(screen),"jpg",f1);
    }catch(Exception e){System.out.println(e);}
    I would like u guys to go through this code and check my claims
    one more thing u need jdk1.4 for this as iam using java advanced imaging api
    Thanks in advance
    regards
    hari

    Hey,
    Why did you ask me that question this is a fully functional code tested on linux and windows and works, Except for i don't see the mouse pointer at all as i already mentioned you should have jdk1.4 for this
    Please let me know as my running out of patience because of this problem
    regards
    hari

  • Firefox Exploit Screen-Captures

    ''locking this thread as duplicate, please continue at [https://support.mozilla.org/en-US/questions/1024867 /questions/1024867]''
    Hi guys,
    Well, I think I bring here a very interesting thing for the Mozilla team. I found I have some sort of exploit which takes screen captures whenever I click on any web page. It is specially active whenever you are entering sensitive information like when I log-in onto site accounts, o whenever I check something on the bank.
    I checked processes using process explorer, and everything points at Mozilla being very active and nothing else. I check the creation of those screen captures and they are always, there.
    I ran several bootable antivirues like Eset, Kaspersky and Bitdefender and they don't detect anything weird. I removed all temp file this "thing" creates while making files and take snap of my screen.
    I also disable all Firefox add-ons, as well as the Java on my computer -I believe there's some connection with Java here-.
    So there, guys!! I don't know where this "thing" resides,

    If you can, send the link for this page;
    '''https://support.mozilla.org/en-US/questions/1024867'''
    to your anti-virus and one or more anti-mal-ware sites.
    As this is something they need to know about to better protect us.

  • Automated Screen Capture

    I was wondering, can anyone think of a way of automating a method of obtaining a screen capture for a list of websites? E.g. let's say I have a list of URLs and I want to get a screen capture of each webpage, does anyone know how I might go about doing it quickly?
    The only way I could think of doing it was using the Robot package to swtich to a web browser, take a screen capture, and then process the image.... I was just wondering if anyone could think of a neater way of doing it?
    many thanks
    BBB

    you said "I'm guessing java wouldn't be the best way to go. "
    I'm under the impression that java can do everything. The trick might be to find out how to do it.
    I
    'll propose one really bad and slow way to do it.
    There is already a swing component that will translate HTML code (that was gathered) into the actual web page.
    Now I believe there is a Robot API that will perform clicks of the keyboard and mouse and simulate an actual user at the computer.
    In this case , you could make it simulate the buttons to do a print screen .
    You could use the robot API to make it paste the result some place and do whatever transformations and saving of the object needed.
    I realize this is a bad way to do it because it is so slow. But it is automated.
    However I am under the impression there is a way to do this effectively and very fast with java.
    I'm guessing it would be using the new nio package in java 1.4
    stephen

  • Is screen capture image making possible?

    We need to do a screen capture and store the image. Is that possible to do?
    In regular Java, screen capture is possible with the com.sun.image.codec.jpeg.JPEGImageEncoder, java.io.File and java.io.FileOutputStream.
    These are not available in J2ME. Would screen capture still be possible, and if so, how could it be implemented?

    Likely the only way to do that is by accessing directly the WinAPI. However doing efficient screen capture through WinAPI is not as easy as calling a single Windows API function. It is quite a bit more involved and the code needs to be able to handle various bit depths in order to work in various screen resolution setting.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Screen capture & MenuItem

    Hi,
    I have a dialog which i want to capture a screen copy of and send to the system clipboard. To capture the screen, the dialog has a menu bar, with a "File->Capture screen" menu item. When this menu item is clicked the dialog is copied to the clipboard.
    All this works fine, but at the time of screen grab, the menu is still dropped down, and is seen in the image on the clipboard.
    Does anybody have any suggestions on how to hide the dropped menu before screen capture ??
    Thanks

    I'm not sure why, but the dialog has to be visible for this to work...
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.util.*;
    import javax.swing.*;
    import java.util.List;
    public class ComponentToClipboard {
        static JDialog dialog;
        static JFrame frame;
        public static void main(String[] args) {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true); //=> paint() does title bar + border
            JMenuBar mb = new JMenuBar();
            JMenu menu = new JMenu("menu");
            JMenuItem launch = new JMenuItem("launch dialog...");
            JMenuItem capture = new JMenuItem("capture dialog to clipboard...");
            menu.add(launch);
            menu.add(capture);
            mb.add(menu);
            launch.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent evt) {
                    getDialog().setVisible(true);
            capture.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent evt) {
                    componentToClipboard(getDialog());
            frame = new JFrame("ComponentToClipboard");
            frame.setJMenuBar(mb);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(400,100);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        static JDialog getDialog() {
            if (dialog == null) {
                dialog = new JDialog(frame, "the dialog");
                JPanel cp = new JPanel(new GridLayout(3,3,3,3));
                cp.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
                for(int i=0; i<9; ++i)
                    cp.add(new JLabel(String.valueOf(i)));
                dialog.setContentPane(cp);
                dialog.setSize(200,200);
            return dialog;
        public static void componentToClipboard(Component comp) {
            int w = comp.getWidth();
            int h = comp.getHeight();
            BufferedImage image = comp.getGraphicsConfiguration().createCompatibleImage(w, h);
            Graphics2D g = image.createGraphics();
            comp.paint(g);
            g.dispose();
            try {
                Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
                ImageSelection selection = new ImageSelection(image);
                cb.setContents(selection, selection);
            } catch (IllegalStateException e) {
                e.printStackTrace();
    class ImageSelection implements ClipboardOwner, Transferable {
        private BufferedImage image;
        public ImageSelection(BufferedImage image) {
            if (image == null)
                throw new NullPointerException();
            this.image = image;
        public DataFlavor[] getTransferDataFlavors() {
            return new DataFlavor[] {DataFlavor.imageFlavor};
        public boolean isDataFlavorSupported(DataFlavor flavor) {
            return DataFlavor.imageFlavor.equals(flavor);
        public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
            if (!isDataFlavorSupported(flavor))
                throw new UnsupportedFlavorException(flavor);
            return image;
        public void lostOwnership(Clipboard clipboard, Transferable contents) {
    }

  • Capture desktop key event to control my screen capture app

    I want to write a screen capture program to capture screen when I am playing fullscreen game or other desktop window application. But the java screen capture program can only receive key or mouse event when it is focused. So how do I capture key event when I am focusing other app or fullscreen app?
    Do I have to use JNI and call some OS specific API. My target OS is WinXP. Help or suggestions are appreciated!!

    Hi All,
    I was wondering if there is a way to capture the top-most
    window or dialog box. This is something that will
    generally be running outside of the JVM....We,
    as programmers, need a Rectangle instance that describes the area
    of interest to be captured (i.e., location and size).
    Thus, a routine that interfaces to the Native windowing system (Toolkit?)
    might look something like:
    Rectangle rect = tk.getRectangleForTopMostComponent();
    Does anything like this exist?
    Thanks!
    - DocJava

  • Screen Capture Timing

    I am trying to write a program which screenshots (using a robot) an HTMLeditorkit inside a jWindow. My problem is that I need a way to ensure that the window is completely drawn before the robot takes the screen capture. I have tried using invokeLater() but it does not seem to help. Any advice would be greatly appreciated.

    What is it with screenshots today..... homework assignment?
    Check out the link shown below:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=375682
    Just use the technique shown at the link to make sure that the page is loaded, then trigger your robot to capture the screenshot.
    ;o)
    V.V.

  • Screen Capture with ActionScript

    Dear all,
    As most of previous posts, I've client application written by
    flash which enable user to create some mind map. Certainly, a
    screen snapshot of the mind map for a thumbnail to png or jpeg and
    uploading to server are necessary features. My developing
    environment is flash, FMS, Apache, PHP and MySQL.
    After searching Google and this forum, I found three options
    available with it's limitation:
    1. Use third party fake web cam driver (monitor pretending
    web cam) but which induce the cost of buying the driver. I just
    wonder if flash 8 can include another class for monitor just like
    the web cam.
    2. With Flash 8, use BitmapData class and post the pixel
    data. It's too horrible if you've a few hundred users.
    3. Writing some plugin to do the screen capture and
    communicate either with the client flash or directly to the PHP
    server. In my project, I prefer the plugin (e.g. written by Java)
    to communicate with flash. As the flash application now already use
    XML to communicate with the PHP server, I would like to use XML to
    communicate between Java and Flash. I haven't check details for the
    Java documentation, I just assume it'll work.
    May be the most practical way is to direct the user to print
    screen and save the file as jpeg or png. However, we developer
    should develop usability. Can anyone suggest some better way to do
    it? Is there any class or tools exist in FMS can make the job
    better done? I'm new to FMS.
    Best regards,
    Teres

    Sounds like you might be running flash in your browser, which
    have no
    solution for, but if yoy are - or can run flash as an exe
    then you can
    make it with mProjector, which adds a captureScreen call into
    Flash
    http://www.screentime.com/software/mprojector/docs/mApp_captureScreen.htm

  • Prevent screen capture, copy and paste

    Hi guys,
    Can Java programming prevent screen capture? Is there any example that I can refer to?
    By the way, is there any example codes on how to disable the function copy and paste, as well as Ctrl + N to open a new browser with the same URL.
    Thanks

    Thanks for the speedy reply.
    I don't think the problem is the number of characters that
    can appear in the tooltip, as I'm having no problem with putting in
    as long a reference as I need. My problem is the actual cutting
    from the RH "document". If I try to cut a relatively short piece of
    text from RH, <100 characters say, and then paste it into word
    (which I did to check that there wasn't any weird formatting), I
    get a line break at between 80-90 characters and always on a
    complete word, i.e. it doesn't break in the middle of the word.
    I was hoping for some solution that would allow me to copy a
    reference from one part of my RH file and then paste the whole
    thing in to my tooltip, but if this is not solveable then I'll just
    have to build in some extra time to my project.
    Thanks again.

  • How do I connect two video cameras to my computer have them both show up on the desktop at the same time so I can see and capture both images using a screen capture program?

    Hello, 
    I am a teacher and want to make some videos to post online for my class.  I would like to have it set up so that I have a powerpoint presentation going, a video camera pointing at a piece of paper I can write on and another video camera pointing at me.  How do I do this?  I have seen several solutions but they seem to be for switching between videos whereas I want both video images to be on at the same time.
    Also, is there a screen capture program you would recommend?

    Go to System Preferences - Sharing and change the computer name there. You can also, optionally, change the name of your hard drive to further clarify the origin of your backups. Click once on the "Macintosh HD" on your desktop, then click its name to allow you to edit it.
    Matt

Maybe you are looking for