What is the easiest way to output only a certain number of digits after a decimal place in a JTextCo

Posted by badpanda on Stack Overflow See other posts from Stack Overflow or by badpanda
Published on 2010-03-26T17:47:52Z Indexed on 2010/03/26 17:53 UTC
Read the original article Hit count: 171

Filed under:
|
|
|
|

I am using both JLabels and JTextFields, and need to be able to truncate my doubles to two decimal places when they are outputted to the application. What is the easiest way of doing this (preferably without switching to JFormattedTextFields)?

Thanks,

badPanda :D

© Stack Overflow or respective owner

Related posts about java

Related posts about swing