wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JTextField and decimal number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextField and decimal number" Watch "JTextField and decimal number" New topic
Author

JTextField and decimal number

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Hi,
I am trying to print out a decimal number like 13.45 in JTextField. I do convert this number from a Double to String and send it to JTextField, but in the applet all I get is 1345 followed by a small square. I tried to type 13.45 in the text field, but it does not let me print "." What should I do? Should I use another component to display decimal numbers?
thanks,
Alex


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
JTextField is fine. How are you converting to a String. Are you using DecimalFormat or just doing a toString? You should use the DecimalFormat to control how you want the number to appear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTextField and decimal number
 
Similar Threads
need a double returned with 2 decimal points
decimal format
Print text of JtextField in java Swing using Printer
Hexadecimal Numbers
Decimals not converting to correct fractions