0
votes

now my jdk7 and javafx2 is the newest. and i would like to code as this way : UI -> FXML (then define controller in .fxml of the top node ) with scene builder. Controller -> the class defined in .fxml .

then i write the logic things in Controller class.

there's a trouble or just my question , how to get the Stage refrence in Controller , as sometimes i need to controller my stage.

(Sorry that my English is poor , but the meaning is almost looks like above)

pls tell me the way to do that , thanks a lot!

1

1 Answers

2
votes

if you bind the elements with the scene with there root elements then you are able to get the stage reference which you bind with them

Stage stage = (Stage)controlObj.getScene().getWindow();