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 7936953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:22:36+00:00 2026-06-03T22:22:36+00:00

I’m working on a game project and I’ve written some basic code that allows

  • 0

I’m working on a game project and I’ve written some basic code that allows the game to run in fullscreen.

My problem is that while the game is in fullscreen mode, I can’t press Prnt Scrn to take screenshots! If I try to take a screenshot, it just screenshots whatever is behind the fullscreen game window. Any ideas why this isn’t working?

I’m running on Windows 7. Here is an SSCCE illustrating my problem:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class FullscreenScreenShotSSCCE extends JFrame
{
    private JPanel screenP;

    private GraphicsDevice grDev;

    /**
    *   Constructor
    *   Preconditions: None.
    *   Postconditions: The window for the SSCCE is created.
    **/

    public FullscreenScreenShotSSCCE()
    {
        super("Fullscreen Prnt Scrn problem SSCCE");
        int screenX = 640;  
        int screenY = 480;
        this.setSize(screenX,screenY);

        // set up resolution change mode

        grDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); // obtains your graphics device

        // setup the game for full-screen if requested.

        System.out.println("Trying to start program in Fullscreen mode.");

        if(grDev.isFullScreenSupported()) // makes sure fullscreen is supported before doing anything.
        {
            System.out.println("FullScreen is supported");
            this.setUndecorated(true);
            DisplayMode resChangeMode = new DisplayMode(640,480,32,DisplayMode.REFRESH_RATE_UNKNOWN); // create new DisplayMode with different resolution.

            try
            {
                grDev.setFullScreenWindow(this); // set fullscreen mode on. Otherwise this won't work
                grDev.setDisplayMode(resChangeMode); // change DisplayMode to our new resolution.
                System.out.println("Change resolution: Success!");
            }
            catch(Exception e)
            {
                System.out.println("Change resolution: FAIL!");
            }
        }
        this.setExtendedState(MAXIMIZED_BOTH);

        // instantiate main panel

        screenP = new SSCCEPanel();
        this.add(screenP);

        // finishing touches on Game window

        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);

        System.out.println("Game Window successfully created!!!");
    }


    public static void main(String[] args)
    {
        FullscreenScreenShotSSCCE gui = new FullscreenScreenShotSSCCE();        
    }
}




/**
*   SSCCEPanel is the JPanel that manages the example's timer, painting, and logic. 
**/

class SSCCEPanel extends JPanel
{
    private Timer timer;
    public double prevFPS;
    boolean timerReady;

    // The SoundPlayer object is used by the example to play the sounds.

    public SSCCEPanel()
    {
        super(true);
    }

    /**
    *   repaints the SSCCE.
    *   This just shows the current FPS and the number of sounds currently playing.
    **/

    public void paintComponent(Graphics g)
    {
            super.paintComponent(g);

            Graphics2D g2D = (Graphics2D) g;
            g2D.setColor(new Color(0x000000));
            g2D.drawString("Java fullscreen!", 20,20);
            g2D.drawString("Try to take a screenshot!", 20,40);
            g.dispose();
    }
}
  • 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-06-03T22:22:37+00:00Added an answer on June 3, 2026 at 10:22 pm

    The problem remains unresolved. In conclusion, the problem is likely inherent in my machine’s graphics devices/drivers since other users cannot reproduce the problem I am having. Therefore, this problem is no longer worth pursuing in native Java.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.