Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:56:14+00:00 2026-05-22T20:56:14+00:00

I wanted to display on the JFrame on the program the full screenshot of

  • 0

I wanted to display on the JFrame on the program the full screenshot of my screen.
So far using the code below, I was able only to display part of the screen.
The code below is the content of the paint(Graphics g).
How can I make it full screen?

// the screen resolution is 1280 x 1024 while the JPanel size is only 1024 x 768
Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rectangle = new Rectangle(resolution);
robot = new Robot();
BufferedImage bufferedImage = robot.createScreenCapture(rectangle);                                
g.drawImage(bufferedImage.getScaledInstance(bufferedImage.getWidth(), bufferedImage.getHeight(), Image.SCALE_DEFAULT), 0, 0, null);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:56:15+00:00Added an answer on May 22, 2026 at 8:56 pm

    Maybe using something like this:

    //get the screen size
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    BufferedImage image = robot.createScreenCapture (dim);
    //other code
    //...
    

    I see you have some errors, I don’t know if your code even compiles, ’cause references seems not to be declared, but a code similar to this one will caputure a screenshoot of your desktop:

    import java.awt.geom.*;
    import java.awt.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import java.io.*;
    
    public class ScreenCapturer
    {
        public static void main(String[] args)throws Exception
        {
            Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
            Rectangle rectangle = new Rectangle(resolution);
            Robot robot = new Robot();
            BufferedImage bufferedImage = robot.createScreenCapture(rectangle);
            Graphics g = bufferedImage.getGraphics();
            //g.drawImage(bufferedImage.getScaledInstance(bufferedImage.getWidth(), bufferedImage.getHeight(), Image.SCALE_DEFAULT), 0, 0, null);
            File out = new File("image.png");
            ImageIO.write(bufferedImage,"png",out);
        }
    }
    

    I saved to an png image file instead of drawing it on the screen or the frame.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi I wanted to display randomly selected images in a view. below is an
I am using Asp.net with jquery I wanted to display information for a specific
I wanted to show the users Name Address (see www.ipchicken.com ), but the only
I wanted to generate one fix view using interface builder, but the size of
I wanted to display a message on the top of my site when the
I wanted to display a number to 2 decimal places. I thought I could
Say I wanted to display the number 123 with a variable number of padded
Let's say I wanted to display a Button and a few RadioButtons . Based
I'm having about 200 icons ,which I wanted to display in a treeview on
Through out my application, i wanted to display the value htmlentities(str), since there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.