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.


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

Results 1 to 2 of 2

Thread: Mouse Click Action Listener for JTextField?

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Thanked 0 Times in 0 Posts

    Default Mouse Click Action Listener for JTextField?

    I'm coding a java replacement for a legacy Motif GUI. It needs to look and respond exactly the same as the Motif app. I need to create a textfield that will bring up a popup menu when the user clicks in the field with the mouse. I added an actionListener but it only responds to a keyboard enter key, it doesn't respond to mouse clicks. How do I get it to respond to mouse clicks?


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

    Default Re: Mouse Click Action Listener for JTextField?

    Recommended reading: How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
    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!

Similar Threads

  1. Replies: 4
    Last Post: August 30th, 2013, 12:57 PM
  2. [SOLVED] trying to change image by mouse click
    By leonne in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 5th, 2013, 08:16 PM
  3. Action Listener
    By Suzanne in forum What's Wrong With My Code?
    Replies: 7
    Last Post: May 29th, 2010, 10:50 AM
  4. Action Listener
    By kray66 in forum AWT / Java Swing
    Replies: 2
    Last Post: April 19th, 2010, 03:26 PM
  5. Need Help Action Listener....
    By vhizent23 in forum AWT / Java Swing
    Replies: 2
    Last Post: October 9th, 2009, 01:46 PM

Tags for this Thread