Cannot bind text field to selected item in JTable in NetBeans
- by titaniumdecoy
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.
The binding seems obvious but does not work; the bound value of the text field is always null.
I bound the text property of the JTextField in NetBeans to:
flowTable[${selectedElement.prefix}]
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,
flowTable,
org.jdesktop.beansbinding.ELProperty.create("${selectedElement.prefix}"),
courseNameTextField,
org.jdesktop.beansbinding.BeanProperty.create("text"));
What am I doing wrong?