I am confused. I want to equals my hourRate into integer only. What should I do?
JTextField hourRate = new JTextField(20);
if (!hourRate.getText().equals(string))
Sorry for bad english
I am confused. I want to equals my hourRate into integer only. What should I do?
JTextField hourRate = new JTextField(20);
if (!hourRate.getText().equals(string))
Sorry for bad english
 
    
     
    
    do likewise,
try {
   JTextField HourRate = new JTextField(20);
   // Convert string integer value to integer
   Integer hourRateInInt = Integer.parseInt(HourRate.getText().trim());
   if (hourRateInInt  != someValue)
} catch (NumberFormatException ne) {
   // Error in string parsing to integer 
}
 
    
     
    
    Try this
You want to compare your HourRate to integer then you must first convert your User Input value to integer and then you can compare your HourRate to another intvalue.
try {
    JTextField HourRate = new JTextField(20);
    int hourRate =Integer.parseInt(HourRate.getText());
    //parseInt() throw NumberFormatException if user not input valid value
    if (hourRate == integerValue) //use == Operator for integer comparison
    {
     //equal value
    }
    else{
    //not equal value
    }
}catch (NumberFormatException ne) {
}
