I am trying to use NetBeans to bind a JTextField to the selected element of a JTable.
The JTable gets its data from an AbstractTableModel subclass which returns Cow objects. At present, each Cow object is displayed as a String through its toString method.
I am trying to bind the text property of the JTextField to the name property of the Cow object which is selected in the JTable.
I bound the text property of the JTextField in NetBeans to:
flowTable[${selectedElement.name}]
This produces the following line of generated code:
org.jdesktop.beansbinding.Binding binding =
org.jdesktop.beansbinding.Bindings.createAutoBinding(
org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
cowTable,
org.jdesktop.beansbinding.ELProperty.create("${selectedElement.name}"),
cowNameTextField,
org.jdesktop.beansbinding.BeanProperty.create("text"));
The bound value of the text field is always null.
What am I doing wrong?