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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:07:42+00:00 2026-06-16T22:07:42+00:00

I have my JFrame in full screen mode using the following: setExtendedState(JFrame.MAXIMIZED_BOTH); setUndecorated(true); And

  • 0

I have my JFrame in full screen mode using the following:

setExtendedState(JFrame.MAXIMIZED_BOTH);
setUndecorated(true);

And I want to know the height. Note that Toolkit.getDefaultToolkit().getScreenSize() does not work because I’m on a Mac and the real height should exclude the height of the Mac bar thing at the top of the screen.

And in the case of Windows, for example, the height should exclude the start bar. Hence, I want to know the true height of the window space I have.

  • 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-16T22:07:43+00:00Added an answer on June 16, 2026 at 10:07 pm

    I use this

    public static Rectangle getScreenViewableBounds() {
    
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
    
        Rectangle bounds = new Rectangle(0, 0, 0, 0);
    
        if (gd != null) {
    
            GraphicsConfiguration gc = gd.getDefaultConfiguration();
            bounds = gc.getBounds();
    
            Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
    
            bounds.x += insets.left;
            bounds.y += insets.top;
            bounds.width -= (insets.left + insets.right);
            bounds.height -= (insets.top + insets.bottom);
    
        }
    
        return bounds;
    
    }
    

    To determine the “safe” screen bounds. This takes into consideration the screen insets and produces a rectangle of a “safe” viewable area…

    Updated

    After a little testing, I’m satisifed (as far as I have Windows with multiple screens) that GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds() seems to return the same results for the default monitor. The benifit of the previous mention method, is it could be used to determine the “safe” bounds for any device

    Credit to Java – Screen Size on a Mac

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

Sidebar

Related Questions

I have a JFrame with some a JTextField and a JButton. I want it
In the application I'm developping (in Java/swing), I have to show a full screen
Right now, I have a full screen application which spawns several full screen JFrames
I have a thread that does display updates on my JFrame by using SwingUtilities.invokeLater.
I would like to have a normal JFrame with its full functionalities (decoration, title,
I have a JFrame and following components. JButton = jButton1 Progress Bar = progressBar
I have a JFrame and JPanel full of Jsomethings with an actionlistener. When the
I have a problem with full-screen : i create a frame and put it
Hey guys, I want my JFrame to close on a mouse click. I have
I have a JFrame with a JPanel on it. I want to add another

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.