I have two separate components, one is a class that extends JTable
, the other is a class that extends JPanel
(contains a form).
Both are displayed on the same view when that application is run, when I click on a row on the table, I expect the textfileds on the form to be updated but nothing happens I use observer (the form class is the listener) pattern to send the clicked row to the class/ panel containing the form fields to be updated, the values are received but the textfields are not updated.
The code below is in the form class and it updates the form fields, the form class is added as a listener in the table class, the method below is fired when a table row is clicked
public void onTableRowClick(CollectedParcelEvent e)
{
JOptionPane.showMessageDialog(null,"test", "test", 1);
txtCost.setText(Double.toString(e.getSource().getCost()));
txtCustomerName.setText(e.getSource().getCustomer().getName());
txtCost.repaint();
txtCost.revalidate();
}