• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JavaFX removing setOnMouseEntered listener does not work properly

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all I am having an issue with removing a listener from my button.

Here is the code that I use in order to add the listener to the button:

The way I am removing the listeners from the button:

My popup code:

This is what it looks like when it starts off, then turned on then back off again. Notice how the tooltip still shows when moving over the button when I have it set to off. It seems to stay on the screen when I move away from the button in the off state.

 
Sheriff
Posts: 4641
582
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't worked with JavaFX, but taking a quick look at the documentation, I don't see where is states that setting the handler function to null removes/unsets a previously defined handler.

Maybe try setting an empty function? :
Or maybe use addEventHandler and removeEventHandler instead? :

 
David Go
Ranch Hand
Posts: 54
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I haven't worked with JavaFX, but taking a quick look at the documentation, I don't see where is states that setting the handler function to null removes/unsets a previously defined handler.

Maybe try setting an empty function? :
Or maybe use addEventHandler and removeEventHandler instead? :


Yep that was the issue. Thanks for the heads up Ron!
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic