All numeric classes have a method parseClassType e.g. parseInt, parseFloat etc etc
Code:
try {
int myValue = Integer.parseInt(textField.getText());
}
catch (NullPointerException npe) {
// Thrown when the underlying document in the JTextField is null.
npe.printStackTrace();
}
catch (NumberFormatException nfe) {
// Thrown if the the text field has a value that can't be parsed to an integer.
nfe.printStackTrace();
}