[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Quick Question on GUI Output  XML
Forum Index » GUI Development
Author Message
leapfrog7

Newbie

Joined: 02/11/2010 23:30:17
Messages: 13
Offline

I have a quick question, I am just learning Java and in my current program I need to create a GUI. My code compiles and works just fine. But the line:



Displays in the format: 2.4000000234

How to I change this to display as currency so it shows: $2.40

Value is a double, and when using the "System.out.printf" it displays just fine. Any help is greatly appreciated.
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

Use something like:

This message was edited 1 time. Last update was at 02/20/2010 11:24:16


Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
leapfrog7

Newbie

Joined: 02/11/2010 23:30:17
Messages: 13
Offline

i was actually just coming to update this post. I tried something similar to what you typed earlier. I think I tried:



But that did not work and would not compile. But, I did finally get it to work by using:



This example worked perfectly. Thanks for your help though, I really love this forum.
 
Forum Index » GUI Development
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle