Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How do I get numeric values from JTextField??

  1. #1
    Junior Member zlloyd1's Avatar
    Join Date
    Nov 2012
    Location
    Norfolk, Virginia
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question How do I get numeric values from JTextField??

    I am trying to figure out what to use to get user input from a text field on an interface, if the values entered were doubles, and not text. I mean I know how to get text, because there is the getText() option, but I could not find any getDouble, and I am not completely confident in using parse.
    I hate to ask for code, but if someone could give me an example of what use for this I would be set, and I NEED IT, because I have a lot more to finish here and my GUI has several fields which are to accept numbers with decimal fractions, and I need to take those numbers, and use them for calculations to return to the user.
    Anyway, if there is no getDouble option available, then what is there PLEASE??
    Last edited by zlloyd1; January 22nd, 2013 at 03:12 AM. Reason: typo


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: How do I get numeric values from JTextField??

    You're asking how to convert a String into a double. Check out the Double API for useful functions.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member zlloyd1's Avatar
    Join Date
    Nov 2012
    Location
    Norfolk, Virginia
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: How do I get numeric values from JTextField??

    Thanks, I will go through the API and see if I can find what I need!!

Similar Threads

  1. Replies: 4
    Last Post: November 28th, 2012, 03:01 PM
  2. Replies: 3
    Last Post: July 25th, 2012, 07:53 AM
  3. Assign Default values to the JTextfield in java swing
    By sjohnfernandas in forum AWT / Java Swing
    Replies: 1
    Last Post: December 17th, 2011, 06:59 AM
  4. Using jbutton to write to jtextfield values to database
    By Sociopath in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 23rd, 2011, 10:53 PM
  5. JTextField getting text values
    By The_Mexican in forum What's Wrong With My Code?
    Replies: 8
    Last Post: November 18th, 2010, 05:41 PM

Tags for this Thread