• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Focus Listener for JavaFX Nodes

 
Anmol Mahatpurkar
Greenhorn
Posts: 10
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a beginner in JavaFX. I am really stuck at this point. And sorry if my English is poor.

I have two stack panes in my JavaFX program. I want to add a focus listener to both of these stack panes.

It should be such that, when I click on one stack pane, it should activate the focus gained method for this stack pane.

Once I click on another stack pane, the 1st stack pane should give a call to its focus lost method, and the current stack pane's focus gained method should be called. Just like we have focus events in the Swing Package.

Currently I have tried this:



I have also tried to set the focus traversable property on the stack pane i.e.


These are not working properly. When I run it, the output only shows these 3 lines, no matter how many times I click on the stack panes.


Please help.
 
Campbell Ritchie
Sheriff
Posts: 51349
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult a question for “beginnning”. Moving to our FX forum.
 
Anmol Mahatpurkar
Greenhorn
Posts: 10
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry. I couldnt find the FX Forum so I posted it in Beginning java. Thank you for moving it.
 
Campbell Ritchie
Sheriff
Posts: 51349
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic