Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with JTextField

 
kelly devon
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
pls someone how do u retrieve information from ur textfield once it has
been entered by a user into the textfield and u do not want to use a button?
how do you go about writting an actionlistener for a JTextFiled?
thx in advance
 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to retrieve the data by the user hitting the Enter key or on a tab out of the field?
 
Jeff Bosch
Ranch Hand
Posts: 805
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Kelly -

Three quick tips:

1. If you spell as badly in your source code as you do in your posts, you'll spend much of your time tracking down compiler errors. Computers require precision.

2. If you read the Java Tutorial, a free in-depth resource available through Sun's Java site, you'll find the answers to most if not all of your questions.

3. If you find the answer yourself, you will always have it. If someone else gives you all your answers, you'll never get it.

Good luck!
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kelly,
Why are you posting duplicated threads?
That thread got the same topic as this thread. I do suggest you to focus on one thread so that you can get people replies in the same place...

BTW, have you tried DocumentListener as I told you in that thread? It will surely help you...
 
Siripa Siangklom
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think KeyListener and FocusListener is the other way to retrieve data from textfield.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic