Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jtextfield  RSS feed

 
Amit S Kulkarni
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want the text field which will accept only capital letters only.can anyone help me.
 
Campbell Ritchie
Marshal
Posts: 56186
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Subclass it and override its setText() and append() methods?
 
Rob Spoor
Sheriff
Posts: 21114
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or check out DocumentFilter.
 
Campbell Ritchie
Marshal
Posts: 56186
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have had second thoughts about my suggestion; it is not true inheritance to add constraints to the input to a subclass. Rob's idea sounds better.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!