File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JavaFX and the fly likes setting EventHandlers in View class from Controller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "setting EventHandlers in View class from Controller" Watch "setting EventHandlers in View class from Controller" New topic
Author

setting EventHandlers in View class from Controller

Benjamin Trenker
Greenhorn

Joined: Jan 26, 2013
Posts: 1
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

Joined: Jul 19, 2011
Posts: 175

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.


Please correct my English.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting EventHandlers in View class from Controller
 
Similar Threads
MVC in swing
O-O event handling..
Listeners in controller class
Separate Actions and GUI
need help for button