The Artima Developer Community
Sponsored Link

Java Answers Forum
Need help with Swing Components Please! :)

1 reply on 1 page. Most recent reply: Dec 5, 2002 7:36 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Amer

Posts: 1
Nickname: sonicpuma
Registered: Dec, 2002

Need help with Swing Components Please! :) Posted: Dec 5, 2002 3:33 PM
Reply to this message Reply
Advertisement
Hi there, i'm just having a little difficulty with GUI's and Swing. Heres the thing, I just created a JTextField called answerText and a JButton called okButton. Now, i was wondering, how do I take the value of answerText when I press the okButton? I wish to make a Guessing Game, where the value of the JTextField is taken, compared with a number from a Math.random method and printed out, of how many times it took to guess the number. I hope someone can help me out!! Thank you :)


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Need help with Swing Components Please! :) Posted: Dec 5, 2002 7:36 PM
Reply to this message Reply
The JTextField has a method called getText() that will return a String containing the text.

Flat View: This topic has 1 reply on 1 page
Topic: the inheritance and polymorphism Previous Topic   Next Topic Topic: Polymorphism & inheritance

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use