Leham789
Leham789

Reputation: 41

How can I cap so the user can only type in one space bar in java JTextField

I need to make sure the user can not type more than two string words into this text box and only use one space bar but not really sure how to write this code. I have everything else working fine!

Upvotes: 1

Views: 47

Answers (1)

Kevin Workman
Kevin Workman

Reputation: 42174

Sounds like a job for an InputVerifier: http://docs.oracle.com/javase/7/docs/api/javax/swing/InputVerifier.html

Upvotes: 2

Related Questions