You can call a very helpful method called pack on the frame and it will automatically set the desired width and height of the frame

Showing the single result

Showing the single result