|
Java™ by example!
|
|
|
How do I limit the length of text entered in a JTextField?
Create a custom component that extends from JTextField and allow the user to specify a maximum length. The implementation is simple: capture the insertString method and execute super.insertString when the condition (current length <= maximumlength) is met. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|