It's hard to know what is specifically wrong without more code, preferably a small compilable program, but in general you should
- make sure that your GUI uses layout managers sensibly and avoids use of null layout if at all possible.
- avoid calling
setSize(...)
orsetPreferredSize(...)
if possible. - pack your GUI's before displaying them by calling
pack()
on the top-level window prior to callingsetVisible(true)
- let the GUI's components and layout managers size themselves.