Actually you do not declare the length of the textfield by passing an int to the constructor. You define the number of characters it can contain (by default). The number of columns will set the preferred size of the component accordingly.
If you want the textfields to be square you will have to set the bounds of those textfield.
If you set the PrefferedSize of a component the layout manager will use this if enough space is available on the parent component. There is also something called minimumSize. If the layout manager notices that the parent component is to small for the child to fit. It will shrink the component taking in account the minimumsize.
You actually have to call the setPreferredSize(int width,int height) method for every component (textfield) that you wish to add. Be aware that the layout manager will also play with the sizes however. If you just want to add a number of textfields on a panel you can use the FlowLayout for instance.
Joined: Jul 23, 2004
Thank you Manuel
I get it!!!
Regards Dave Morley
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com