I'm trying to create a simple app which read content of .xml files and display it into JavaFX window as a slideshow.
However, it is not possible to use attributes in start
method? Are they set?
Source code
public class App extends Application {
private ArrayList<LomDocument> filesList = new ArrayList<LomDocument>();
private int index = 0;
public void start(Stage primaryStage) {
...
// Fill file list
File directory = new File("src/main/resources/lom");
for (File file : directory.listFiles()) {
LomDocument lom = new LomDocument(file.getAbsolutePath());
this.filesList.add(lom);
}
System.out.println(this.filesList.size()); // Return 6
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
public void nextSlide() {
System.out.println(this.filesList.size()); // Return 0
if(this.index < this.filesList.size()) {
this.index++;
}
}
}
With index
I know on what slide I am.
As it mentionned on the code, when I click on the button nextSlide
, this.filesList.size()
return 0
whereas in start
method size is 6
.
Can you help me to understand why value is not the same?
Thank's for help!