I have a JTextField which users must enter a number in that.
I want to check the value to be sure that it contains an **Integer*.*
Here is the code:
JTextField Tex_amount=new JTextField();
.
.
.
String s=Tex_amount.getText();
int a=Integer.parseInt(s);
The problem is if the user enter a String in the field i will face with the error: java.lang.NumberFormatException. So how can i check the value?