[Logo]
Forums Register Login
textfield and listener
hi.. am now preparing a new project.. i need to display Table when mouse button s pressed in a Text Field.. can anyone help me what type of listener we can use for that...thank you
Hi Ambika,

Welcome to Java Ranch. I am unable to recollect it very soon. But it would be an ActionListener. I guess other Ranchers would be helping you out.
 
Ambika Nagalakshmi wrote:.. when mouse button s pressed in a Text Field..

What you need is a mouse listener.
What Raghavan said is not quite correct. The action listener will be fired only if the text field has focus and the user hits the enter/return key.
 
Maneesh Godbole wrote:
Ambika Nagalakshmi wrote:.. when mouse button s pressed in a Text Field..

What you need is a mouse listener.
What Raghavan said is not quite correct. The action listener will be fired only if the text field has focus and the user hits the enter/return key.


Thanks Maneesh. yes, thats what I said I was unable to get it immediately. (Its been a long duration I worked with Swings/Applets).

Indeed it would be a MouseListener.
 
Maneesh Godbole wrote:
Ambika Nagalakshmi wrote:.. when mouse button s pressed in a Text Field..

What you need is a mouse listener.
What Raghavan said is not quite correct. The action listener will be fired only if the text field has focus and the user hits the enter/return key.



then i have to mouse listener... but if i want to display table when i point over the text field means what to do?
i need reply soon ya.. help..
Ideally speaking you should have the table as one of the components in your page/application. Upon clicking by mouse you should be updating the model (data) of the table so that it will display the contents. Swing is based on MVC (Model View Controller) Pattern.

You can spend sometime in reading the tutorial here : http://java.sun.com/docs/books/tutorial/uiswing/components/table.html. It should help you to get through!
 
Ambika Nagalakshmi wrote:i need reply soon ya.. help..


Hi Ambika,

The Java Ranch is said to be one of the friendly forums. It indeed exists to "help" the people but not upto the urgency of the seeker. As you know, individuals are taking their time out to help the members we can NOT really force any one to help us. It is one of the mandatory rules in the forum.

Please read this rule : PatienceIsAVirtue

As I have mentioned in the earlier post, please read out the tutorials in the sun's website. Google for the same. You might get the result by the time people see it and reply for your query Good luck!
 
Ambika Nagalakshmi wrote:
then i have to mouse listener... but if i want to display table when i point over the text field means what to do?


Recommended reading http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
http://faq.javaranch.com/java/EaseUp
http://faq.javaranch.com/java/PatienceIsAVirtue
 
Ambika Nagalakshmi wrote:i need reply soon ya.. help..

http://faq.javaranch.com/java/UseRealWords
"Ya" is not a valid English word.
ok.. thanks. it worked.


hi here is my code.
when i run this am getting table frame alone. but the value inside the table is not executing. where i need to change??
thanks
Ambika,
In future, while posting code, please use code tags
http://faq.javaranch.com/java/UseCodeTags
 
Maneesh Godbole wrote:Ambika,
In future, while posting code, please use code tags
http://faq.javaranch.com/java/UseCodeTags


Check the following code
hi thanks.. that worked..
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 18, 2017 09:16:05.