I'm trying to bind a TextField to a String (the attribute "nombre") in my program. I've seen that you can bind two JavaFX objects with the bind()
method, but since java variables don't have properties, I am unable to use it in order to bind my TextField to a String. Here's the class where I'm trying to achieve this (without getters and setters):
public class NodoJugadores implements Serializable
{
private String nombre;
private int cedula;
private String sexo;
private int edad;
private String equipo;
private int categoria;
private int puntos;
private NodoJugadores proximo;
private NodoJugadores hijoIzquierdo;
private NodoJugadores hijoDerecho;
public NodoJugadores(String nombre, int cedula, String sexo, int edad, String equipo, int categoria, int puntos, NodoJugadores proximo)
{
this.nombre = nombre;
this.cedula = cedula;
this.sexo = sexo;
this.edad = edad;
this.equipo = equipo;
this.categoria = categoria;
this.puntos = puntos;
this.proximo = proximo;
}
public NodoJugadores(String nombre, int cedula, String sexo, int edad, String equipo, int categoria, int puntos, NodoJugadores hijoIzquierdo, NodoJugadores hijoDerecho)
{
this.nombre = nombre;
this.cedula = cedula;
this.sexo = sexo;
this.edad = edad;
this.equipo = equipo;
this.categoria = categoria;
this.puntos = puntos;
this.hijoIzquierdo = hijoIzquierdo;
this.hijoDerecho = hijoDerecho;
}
public void llenarGrid(GridPane grid)
{
if(sexo.equalsIgnoreCase("m"))
{
for(int i = 0 ; i < 8 ; i++)
{
TextField text = new TextField(nombre);
grid.add(text, i, 0);
}
}
}
static final long serialVersionUID = 8925409;
}
Please, try to explain with an actual example of how this would work. I would greatly appreciate it. Also, it's worth mentioning that I can't convert my String to a StringProperty because I'm Serializing the class.