I normally don't go on sites like these but I got a serious nooby question and can't really find out how to fix this.
So I have a simple dice that rolls when you hit a button. It prints out all the dice numbers in the console. Now I want to save the last int so I can do calculations etc with it. Now the problem is I have serious no idea how to get the last int of the dice and print it out in the console. Does anyone have experience in this and can help me? Here is my code:
btn.setText("Roll Die");
btn.setOnAction((ActionEvent event) -> {
btn.setDisable(true);//Disable Button
Random random = new Random();
int gekozen = Integer.parseInt(tf3.getText());
Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(.3), (actionEvent) -> {
int tempRandom = random.nextInt(6) + 1;
System.out.println(tempRandom);
die.setDieFace(tempRandom);
}));
timeline.setCycleCount(random.nextInt(20) + 1);
timeline.play();
timeline.setOnFinished(actionEvent -> {
btn.setDisable(false);//Enable Button
});
});