December 3rd, 2012, 10:52 AM
Hi, how can I check whether a number that is transformed by a wrapper class is negati
I used the following code to check whether a input number is negative or not.
But it's not working.
Can anyone please help me?
private JTextField theLength; //a type of JTextField
private JLabel theLabel //a type of JLabel
public static double stringToDouble(String stringObject)
public void actionPerformed(ActionEvent e)
if ((stringToDouble(theLength.getText())) < 0)
theLabel.setText("the number is negative.");
December 3rd, 2012, 12:06 PM
Is this all the code? You never have an event so the code won't run.
December 3rd, 2012, 01:02 PM