Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatting numbers in a JTextArea

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the best way of doing this?

JTextArea doesn't have a "printf" method, just "append".

For example



I want to cut the number calculated in this expression down to 2 decimal places.
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing the solution!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic