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 2 of 2

Thread: Reading in an int from a JTextField?

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Reading in an int from a JTextField?

    So I have three text fields (name, X, and Y) and a method that moves an image (whose name corresponds to the 'name' entered by the user in the text fields) to position X and Y based on what the user inputs in those text fields once a button is clicked.

    Code Removed

    The name passes okay, but I have no idea how to parse the X and Y values so they're left as question marks :/

    Thanks if you could point me in the right direction

    EDIT: Figured it out. sorry. Just used:
    Integer.parseInt(X.getText()
    Last edited by Cobalt; March 23rd, 2012 at 12:46 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Reading in an int from a JTextField?

    how to parse the X and Y values so they're left as question marks
    Can you explain what you are trying to do.
    Are x and y int variable?
    Is the question mark you talk about a String: "?"
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Make a JTextField
    By n00b in forum AWT / Java Swing
    Replies: 4
    Last Post: November 2nd, 2011, 11:01 AM
  2. Need help int JTextField
    By n00b in forum What's Wrong With My Code?
    Replies: 7
    Last Post: November 1st, 2011, 09:57 AM
  3. how to delete a JTextField?
    By A4Andy in forum AWT / Java Swing
    Replies: 10
    Last Post: August 31st, 2011, 11:33 AM
  4. JTextField ActionListener
    By macko in forum What's Wrong With My Code?
    Replies: 9
    Last Post: May 30th, 2011, 01:53 AM
  5. Jtextfield Validation
    By nimishalex in forum AWT / Java Swing
    Replies: 8
    Last Post: December 11th, 2010, 02:42 AM