• Post Reply Bookmark Topic Watch Topic
  • New Topic

textfield and listener  RSS feed

 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need reply soon ya.. help..
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ambika Nagalakshmi wrote:i need reply soon ya.. help..

http://faq.javaranch.com/java/UseRealWords
"Ya" is not a valid English word.
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.. thanks. it worked.
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ambika,
In future, while posting code, please use code tags
http://faq.javaranch.com/java/UseCodeTags
 
santhosh varala kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Ambika,
In future, while posting code, please use code tags
http://faq.javaranch.com/java/UseCodeTags


Check the following code
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi thanks.. that worked..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!