This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Is there a way to validate the data in the JTextField. I only want the user to input numeric values. But i want to be able to trap the key as soon as the key is released. If it is numeric, then it is displayed on the screen. otherwise, whatever is typed is not displayed on the screen anymore. TIA
add a TextListener for the textField. then override the method textValueChanged(TextEvent e). check for the value that changed. if it is a number continue, otherwise use the consume method to do nothing. hope it helps.