Skip to content
Advertisement

JavaFX: TextFields displayed from array, array updated / increased on button click – how to force the scene to redraw the updated array

I have a program that displays animals and their names:

JavaScript
JavaScript
JavaScript

The method associated with Add animal button:

JavaScript

The code inside addAnimals does execute, but the new text field doesn’t appear. How should I fix it?

Advertisement

Answer

You forgot to add the text fields to grid, just creating a textfield doesn’t show it you need to add it to your like you did in your start function. You would also need to make the GridPane a variable in the class.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement