NetBeans (Java Swing): setting the window size
•
Java
It really drives me crazy When I set the appropriate size for my window in design mode, it just ignores this size and uses something else at compile and run time Even if it's hard for me to set minimumsize and preferredSize, it just ignores this... Why? How do I set my own size?
Solution
Even if you set the size using minimumsize and preferredSize, you may forget to call window Pack(), where swing will resize the component (and all its subcomponents) according to the set size
After setting all the preferred sizes, you can call it in the window (or anything in the build window).
Alternatively, you can use component Setsize() method, but it can use comes with some caveats
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码