• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about JTextField

 
Adithya Rayaprolu
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to limit the number of characters to 10 and also limit the characters to only digits that can be entered into a JTextField. Can I safely use awt events on JTextField or do I have to use only Document?
Thanks in advance.
 
PierreArnaud Galiana
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest to use the Document, as described in the Tutorial.
Take advantage of the MVC architecture of Swing: the model (Document) contains the text, the view/controler (JTextField) displays/controls it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!