• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting EventHandlers in View class from Controller

 
Benjamin Trenker
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i've just started playing around with JavaFx2 and Scala. Trying to achieve a 'Passive View' I soon ran into problems setting EventHandlers for my buttons from within the controller class, 'cause the EventHandler never gets triggered when setting it this way:



It would be nice if anybody could tell me how it is possible doing it this way instead of setting the EventHandler directly in the View - class.

thanks in advance,
Benni
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how you are setting up your view. If you are using a FxmlClassLoader you could use something like

You would obviously have to change it to Scala. If you are doing this without fxml i am not sure if that is a build in feature of javafx. I am not that familiar with Scala though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic