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!

JTextField max length, JTextArea automatic scrolling

843804Mar 3 2005 — edited Mar 4 2008
i cant find how to do 2 things,

i would like to limit the size of the text entered in a JTextField
i could probably do this by making its KeyListener trim off the extra from getText() and use setText(whateverIsLeft) but i was hoping there was a better way of doing this with something that is already there as this is a lot of work considering soemoen could just hold down a button and it would have to do it several times a second

also i need to set a JTextArea inside a JScrollPane so that when new text is appended to it, it scrolls the jtextpane down to the bottom, i could just make it write it at the top instead of appending it to the bottom but i REALLY dont want to =p

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2008
Added on Mar 3 2005
10 comments
1,714 views