I'm currently using javaFX to build a visualization tool. You can see in the image below there are textboxes and green buttons. For every textbox with a 0 shown, it is linked to a specific button beneath it. However, the button is only supposed to turn green if the input value is 1. In case of input 0, the button is supposed to be white; and in case of any other number, an error message is supposed to pop up.
scene builder preview
I tried to make a class in Controller.java that would intake the fx:id from scenebuilder but that didn't work. I'm trying to find a way where I am able to use specific names for each textbox because each one is linked to a different button.

One thing you can do is create a
ChangeListenerto handle all the logic. The other is you can create a differentChangeListenerfor eachTextField.Example of
ChangeListenerfor allTextFields.CSS
Output
Edit after feedback
CSS is not a strong point of mine. This can probably be improved.
.getStyleClass()setIdto alter its style.