• 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

Invoking Method

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this program that uses Label object to serve as a button like a hyperlink in a web page.
I add a MouseListener to every instance of the label object, i used MouseEntered and MouseExited to changed the foreground color and the cursor. The only thing i wondered is if I can invoke another method inside MouseReleased method that is not yet known?I mean inside the class it will handle the entering and exiting of the mouse but the releasing of the mouse button will be handled by some other class who use it. Do i have to make my own listener? Please help and thanks in advance..
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not at all sure that I understand the question.
You can add more than one mouse listener to the same label. More than one of those listeners can listen for mouse release. Each one can then check what is going on to see if they really want to do something or not.
On the other hand you could have just one listener that listens for mouse release, and then depending on some other conditions, it can do different things.
Yes you will probably need to make your own Listener to accomplish this.
 
The only thing that kept the leeches off of me was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic