Hi Guys,
As you will see from my code snippet below, I have a masked text field that only allows the user to input a number between 0 and 9. I have wired up an event as when the user inputs a number I need to extract the number and populate a property on my class. I am using the keyTyped method to capture the user input. As I know this will always be a number how I extract this into a variable of type integer?
MANY THANKS
MaskFormatter formatter = new MaskFormatter("#");
formatter.setValidCharacters("0123456789");
JFormattedTextField myField = new JFormattedTextField(formatter);
volumeTextField.addKeyListener(new KeyWatcher());
private class KeyWatcher extends KeyAdapter
{
public void keyTyped(KeyEvent e)
{
// Get to number?
}
}