Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

What purpose does setColumns have?

843805Apr 6 2006 — edited Apr 7 2006
I was trying to limit the users from entering more than 5 characters in a JTextField. I tried to this by setting the columns to 5. This did not work. I understand that there programatical solutions using DocumentListener and such, but it seems like the whole point of setColumns ought to be for this very purpose.

So, my question is, if this is not its purpose, just what is it suppose to do? There already is a setPreferedSize function, so that should not be the answer. But, beyond those two, I cannot come up with another rational for its existence.

Oh, and if there is simple flag that I am missing to restrict the number of columns (or rows, for that matter), I would appreciate that information too.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 5 2006
Added on Apr 6 2006
2 comments
214 views