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: 
Don't set the minimum size. It is the job of the layout manager to determine the size of a component. The layout manager will do its job on all OS.

All you need to do is add the components to your panel/frame and then use:

```
frame.pack();
frame.setVisible();

```

The `pack()` method invokes the layout manager so all the components will be sized properly.

Read the section from the Swing tutorial on [Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html) for more information and working examples. I suggest you bookmark the tutorial for tutorial all the Swing basics.

> 
> i don't want the user to be able to set the size of the frame below a certain size.
> 
> 
> 

It is extremely annoying when an application tells me how small (large) I can make the frame. The desktop is my space, if I want to make it smaller (larger) then you should not care. I can then make the frame larger (smaller) later if I am missing information. Your frame design should be flexible to allow resizing.

In any case you can set the minimum by doing something like:

```
frame.pack();
frame.setVisible();
frame.setMinimumSize( frame.getSize() );

```
add this method in your constructor

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

```