Question: I am building a program and working on it on multiple operating systems. Windows 10 and Windows 7. When I set the minimum size correctly for one either Windows 10 or Windows 7 it works for that OS but messes up the other OS. Is there a way to get the setMinimumSize to adjust for border thickness? Or is there a way to get the thickness of the border on that OS? Or is there a way to get set the minimum size of the JFrame to the size it is when it opens? Any help is appreciated. Thanks.

Answer: 
add this method in your constructor

```
    this.setMinimumSize(new Dimension(width,height));

```
I just ran into a problem like this on macOS using Java 8. I wanted the user to be able to resize the window but obey the minimum size computed by the layout manager. Unfortunately, the AWT code that controls the window size only looks at the minimum size if it has been explicitly set.

Here is the solution I came up with. I override the doLayout() method on the frame:

```
@Override
public void doLayout()
{
    super.doLayout();

    LayoutManager m = getLayout();
    if (m != null) {
        Dimension d = m.minimumLayoutSize(this);
        setMinimumSize(d);
    }
}

```

Now, every time the layout is recomputed, the new minimum size is cached as an explicitly set value, so that AWT will pay attention to it.