I want to be able to input only capital letters to my GUI and so I just need the easiest way to cap/stop people from entering lowercase.
JTextField jt = new JTextField(12);
I want to be able to input only capital letters to my GUI and so I just need the easiest way to cap/stop people from entering lowercase.
JTextField jt = new JTextField(12);
DocumentFilter
Do Like this example
You create a JTexfield, then you need add the event keyTyped and add this code:
One more example of DocumentFilter
Try the following:
This way you will capitalize everything before processing the data.
Use a
DocumentFilter
Take a look at Implementing a Document Filter for details and MDP's Weblog for examples