DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Posts
    4

    Lightbulb Need help, Please

    I don't understand why this is not working for me.

    When I ask to println it does show me the right answer, but when I try to MessageDialog, it dosnt!!

    /* Generated by Together */

    import javax.swing.*;
    class ConvertDgrees
    {
    public static void main(String[]args)
    {
    String cel;
    int celInt;
    float fer;
    cel=JOptionPane.showInputDialog("Celsius?");
    celInt=Integer.parseInt(cel);
    fer=celInt*9/5+32;


    //System.out.println(fer);
    JOptionPane.showMessageDialog(null,fer);
    System.exit(0);
    }
    }
    Tal

  2. #2
    Join Date
    Jul 2002
    Posts
    26
    This code doesn't even compile. Try passing showMessageDialog( null, new Float( fer ) ) There is no version of the shoMessageDialog method that takes a float as one of its parameters.

    -gc

  3. #3
    Join Date
    Nov 2002
    Posts
    4

    soooooooooo.....

    Is there a way to change float back to String...?

    Thank you for your help!!
    Tal

  4. #4
    Join Date
    Jul 2002
    Posts
    26
    float f = 1.20;
    String floatString = Float.parseFloat( f );

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links