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

  • SEARCH
  • Home
  • 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 694993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:54:49+00:00 2026-05-14T02:54:49+00:00

My weird monitor’s native resolution isn’t recognized by Windows, so I have to set

  • 0

My weird monitor’s native resolution isn’t recognized by Windows, so I have to set a custom resolution for it. The problem is that java doesn’t recognize it since it’s not on Win7’s “approved” list, so full-screen mode gets “stuck”. Netbeans comes out of full-screen fine, so there has to be a way around this. Anyone know it?

//Edit (3/29/2010): It looks like NetBeans is faking fullscreen rather than actually going into Full-Screen Exclusive mode, so this may not actually be solvable. For now, I’m also faking it. Seems like java ought to recognize the active DisplayMode as valid, though.

This example reproduces the issue:


package resolutionexample;

import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class Main {

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable(){
            public void run() {
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                GraphicsDevice gd = ge.getDefaultScreenDevice();

                DisplayMode currentDM = gd.getDisplayMode();

                boolean currentInAvailable = false;

                System.out.println("Available resolutions:");
                for ( DisplayMode availDM : gd.getDisplayModes() ){
                    //System.out.println(availDM.getWidth() + "x" + availDM.getHeight());
                    if ( availDM.equals(currentDM) ){
                        currentInAvailable = true;
                    }
                }

                System.out.println("Current resolution: " + currentDM.getWidth() + "x" + currentDM.getHeight() );

                System.out.println("Current in available: " + currentInAvailable);


                JFrame frame = new JFrame("Resolution Bug Example");
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                if ( !gd.isFullScreenSupported() ){System.exit(0);}

                gd.setFullScreenWindow(frame);

                gd.setFullScreenWindow(null);
            }
        });
    }
}

Output running 1680×1050 (the monitor’s wonky native resolution):


run:
Available resolutions:
Current resolution: 1680x1050
Current in available: false
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Invalid display mode
        at sun.awt.Win32GraphicsDevice.setDisplayMode(Win32GraphicsDevice.java:393)
        at sun.awt.Win32GraphicsDevice.setFullScreenWindow(Win32GraphicsDevice.java:329)
        at resolutionexample.Main$1.run(Main.java:43)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
BUILD SUCCESSFUL (total time: 2 seconds)

Output if I set my resolution to 1024×768 before running:


run:
Available resolutions:
Current resolution: 1024x768
Current in available: true
BUILD SUCCESSFUL (total time: 2 seconds)
  • 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-14T02:54:50+00:00Added an answer on May 14, 2026 at 2:54 am

    What do you mean with stuck? Not a good resolution or no real fullscreen mode? For a big screen you could try

    Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().
                     getMaximumWindowBounds();
    JFrame frame = new JFrame();
    frame.setPreferredSize(new Dimension(rect.width, rect.height));
    

    For the fullscreen toggle you could simply copy the sources from netbeans’ MainWindow 🙂

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

Sidebar

Related Questions

Weird null error. I have a /lib/task rake script that refuses to set a
Weird problem here, we're running a few mixed environment web applications, that use Windows
I have a file containing data that I'd like to monitor changes to, as
I have a problem in that my application works fine normally, but I have
I have a weird problem with vector in C++.. I created a vector and
This is on MySQL 5.0. I have a legacy program that had a weird
I have weird situation in newly installed server, and it seems that Google can't
Weird problem this. I've got a web page that fades images in and out
Weird problem in Django with forms : I have a Form.class defined like this
Weird problem. I update the site CSS sheet and the changes show straight away

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.