location - How to call functions on the stage in JavaFX's controller file -
i using javafx along with fxml, use controller real coding. need few operations on stage, such getting x- or y-axis position. have tried stage.getx() & stage.gety, don't work(the stage name high-lited error). how use such functions in controller? tried doing in main file:
public int locationx = stage.getx(); and
public double locationx = stage.getx(); but doesn't work, instead makes whole program 1 big error.
how such functions in controller file? need import or above in way?
error: cannot find symbol locationx = stage.getx(); symbol: variable stage location: class fxmlcontroller
know "stage" missing. how get "stage" in controller?
from root pane in fxml file :
@fxml parent root you can stage by:
stage stage = (stage) root.getscene().getwindow() you have reference stage, can want.
Comments
Post a Comment