JTextField textField = new JTextField(string, string.length()).
Later, I want to change the string to a longer one, by calling
textField.setColumns(longerString.length());
textField.setText(longerString);
This does not work, setColumns has no effect, setText does work, the
string displayed changes but does not fit in the field.
Why? Please explain, thank you. Mark
>This does not work, setColumns has no effect, setText does work, the
>string displayed changes but does not fit in the field.
this means the optimum box size will change. However, it won't be
redrawn until you re-validate.
That number is very approximate since you are not using a fix-pitch
font.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com