This content has been marked as final. Show 9 replies
You really need to bone up on floating point number representations... Java's double is like (but is not the same as) the 64 bit floating point representation specified by IEE754... you can google for that, or for the "java language specification floating point".
But yeah, I reckon javax.swing.text.NumberFormatter (or java.text.NumberFormat) will solve your immediate problem.
Thanks all for your help. I'm looking into the code you sent me but at the moment I get a compile error:
"DecimalFormat cannot be resolved into a type"
for information, my header reads:
//Caravan loading program
//Written by CPGL
//Applet will calculate nose weight, mass and inertia of a caravan and use this to
//determine damping ratio (crudely speaking)
public class caravansnake6 extends Applet
implements MouseListener, MouseMotionListener, ActionListener, Runnable
Do I need to import some other class to be able to use the DecimalFormat code?
thanks again - this is my first real use of a forum by the way and I'm totally sold!
...Try finding that answer yourself by using your favorite search engine to see in what package DecimalFormat resides (and thus, need to import).
Do I need to import some other class to be able to
use the DecimalFormat code?
thanks again - this is my first real use of a forumYou're welcome.
by the way and I'm totally sold!