• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

textfield and listener

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok.. thanks. it worked.
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ambika,
In future, while posting code, please use code tags
http://faq.javaranch.com/java/UseCodeTags
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi thanks.. that worked..
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic