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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:21:27+00:00 2026-06-06T13:21:27+00:00

I have a strange problem. I am using the null layout for a window

  • 0

I have a strange problem. I am using the null layout for a window (= JFrame and on windows) and if I use setResizable (false) the window size gets bigger (to right and bottom, around 10 pixels I would say). I do not know why.

The two println’s return the same sizes, what is strange, also…

mainWnd.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainWnd.setTitle(wndTitle);
mainWnd.setBounds(wndPosX, wndPosY, wndWidth, wndHeight);
System.out.println(mainWnd.getHeight() + mainWnd.getWidth());
mainWnd.setResizable(false);
System.out.println(mainWnd.getHeight() + mainWnd.getWidth());

Does somebody has an idea? Why does the window gets resized?

UPDATE:
Same thing here (compile it with and without the setResizable and than you can see it, if you overlap the windows):

import javax.swing.JFrame;
import javax.swing.JPanel;


public class Main
{
    private static JFrame mainWnd = null;

    public static void main(String[] args)
    {
        mainWnd = new JFrame();

        mainWnd.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainWnd.setTitle("asda");
        mainWnd.setBounds(50, 50, 300, 300);

        mainWnd.setResizable(false);

        mainWnd.setVisible(true);
    }
}
  • 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-06T13:21:28+00:00Added an answer on June 6, 2026 at 1:21 pm

    It does not change on my example, so you must have something else that causes your issue:

    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    
    public class Test4 {
    
        protected static void initUI() {
            JFrame frame = new JFrame("test");
            frame.setBounds(0, 0, 300, 200);
            frame.setVisible(true);
            System.err.println(frame.getSize());
            frame.setResizable(false);
            System.err.println(frame.getSize());
        }
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
    
                @Override
                public void run() {
                    initUI();
                }
            });
        }
    }
    

    EDIT/UPDATE:

    Somehow insets are incorrect when you set the resizable to false (at least on Windows 7 and JDK 6). Somehow they change from 30,8,8,8 to 25,3,3,3 although the border (which is painted by the OS) stays actually the same. Since insets are part of the bounds of the Frame, the frame is actually too big (visually) when it is not resizable. For me it looks like there is a bug in the computed insets when the frame is not resizable.

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

Sidebar

Related Questions

I have an strange problem using two borders. I use them to display video
I have a very strange problem with using geometry shaders. I made a very
I do have a strange focus problem when using a JComboBox inside an embedded
I have strange problem with receiving data from socket. On client im using air
I have a strange problem with lxml when using the deployed version of my
I have a strange problem. I do this query in a node.js server using
I have run into a strange problem on Android , using jQuery mobile and
I have a really strange problem. I'm using jQuery 1.7.1 and UI 1.8.17 for
I have a strange problem when deleteting records using linq, my suspicion is that
I have some strange problem in my WPF app. I'm using a MVVM pattern

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.