File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTextField Listener

 
James Clinton
Ranch Hand
Posts: 190
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I need a listener on a JTextField to be actioned so to speak when a click is made in the box using the cursor.
Using ActionPerformed only works when RETURN is hit.
tmpTimeField.addActionListener(myListener);
Any ideas how this can be solved ?
Is there a Click Listener ?
Thanks
/ James
 
James Clinton
Ranch Hand
Posts: 190
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved using FocusListeners..
Example:
 
Dorothy Finkel-Laverty
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silly question, but have you thought about using a MouseListener? You can count the clicks and everything. The problem with the solution you are proposing is that even if the user tabs to the text field, the event will be fired. Is that what you want?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic