I am trying to use NetBeans to bind a JTextField to a selected JTable element.
JTable gets its data from a subclass of AbstractTableModel, which returns Cow objects. Currently, each Cow object is displayed as a string using the toString method.
I am trying to bind the text property of the JTextField property to the name property of the COW object that is selected in JTable.
I bound the text property JTextField in NetBeans to:
flowTable[${selectedElement.name}]
The result is 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 associated text field value is always null.
What am I doing wrong?
source share