Thanks for the help !!

[quote author=Fu-Kwun Hwang link=topic=1309.msg5027#msg5027 date=1258529413]

b=new Double(uvalue).doubleValue(); // or  b=Double.parseDouble(uvalue);

[/quote]

I am experiencing problem getting this code to work.

i modified into
enterK1f= new Double(l_enterK1f).doubleValue(); // no value is assigned to enterK1f
enterK1f=Double.parseDouble(l_enterK1f); // also no value is assigned to enterK1f

// when this above line(s) is/are active, the applet cannot move? , commented lined then applet can move. ???

l_enterK1f is the text input field and it is working !.
but strangely no value is assigned to enterK1f from the string  l_enterK1f.

[b]Is the code correct?[/b]  [color=red]b=new Double(uvalue).doubleValue(); // or b=Double.parseDouble(uvalue);[/color]

the rest is actually implemented nicely i think, need to test again after getting   enterK1f to show the value.


my fixed relations is now

// enterK1f= new Double(l_enterK1f).doubleValue();
// enterK1f=Double.parseDouble(l_enterK1f);
// enterK1f= valueOf(l_enterK1f);

if(l_answer.compareTo(l_enterK1f)==0){// exactly the same
K1fcorrect = "Great! You have the right answer!";
K1fcorrectbackground = java.awt.Color.GREEN;
}
else {// different string but might be correct value
// double a,b;
// a=new Double(l_answer).doubleValue(); //or  a= Double.parseDouble(ans);
// or  b=Double.parseDouble(uvalue);
if(Math.abs(answer-enterK1f)<1.e-6){// same value but different digits or incorrect format
K1fcorrect = " Check the number of digits ";
K1fcorrectbackground = java.awt.Color.RED;
}

else {// different value
//double c;
// c=new Double(l_enterK1f).doubleValue();
K1fcorrect = " Incorrect, Your input is out by "+ (answer - enterK1f) ;
K1fcorrectbackground = java.awt.Color.RED;
}
}