For detecting clicks inside a JTextField instance, you would simply add a
mouse-listener or
mouse-adapter to your instance.
This might help:
----------------
package org.blahblah;
import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class ClickOnTextField {
public static void main(String[] args) {
JFrame frame = new JFrame();
JTextField field = new JTextField();
frame.add(field);
field.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
System.out.println("Mouse Clicked");
}
});
frame.pack();
frame.setVisible(true);
}
}