I'd like to create a GUI where some of the textfields are resizable horizontaly but maximum width is also specified. For instance the preferred width is 100 pixels, it can be bigger if the window is resized, but the maximum allowed width is 200 pixels. GroupLayout supports this, we can specify the max size in the addComponent method (alongside with minimum and preferred).
I'm using Netbeans and Swing GUI Builder (Matisse). I can set the textfield to be resizable, I can set the preferred size, but I've found no place to set the maximum size (and for the minimum). Here is the layout section of the property sheet:
Since maximum size cannot be set, Netbeans use Short.MAX_VALUE
instead, so if a textfield is resizable it has no upper limit. I've also tried to set the maximumSize
property of the component but it has no effect and will be ignored.
If I manually edit the .form
file I can change the max="32767"
part to max="200"
and Netbeans generate correct code. Is there a way to set it without manually editing the .form
file?