In my application everything is distributed.
- On a action, application retrieves data from DB and saves in
ArrayList<T>
. I create an object of
RelativeTableModel
where I pass theArrayList<T>
.public void RelationsClicked() { ArrayList<Relation> data = myParent.dbOperation.getRelations(); RelativeTableModel tModel = new RelativeTableModel(data); // subclass of AbstractTableModel myParent.SetBrowsePanelData(tModel); myParent.SetMainPanel(CashAccountingView.BROWSEPANEL); }
- I have a
BrowseListPanel
class that has aJTable
inJScrollPane
. Its instance is already created in the main application. - I pass the model to
BrowseListPanel
and finally show the panel.
- I have a
Code:
public void SetBrowsePanelData(AbstractTableModel tModel) {
browsePanel.setTModel(tModel);
}
// BrowseListPanel's Code
public void setTModel(AbstractTableModel tModel) {
this.tModel = tModel; // tModel = AbstractTableModel
}
// Show the Panel
public void SetMainPanel(String panel) {
activePanel = panel;
SetFontSize();
cards.show(mainPanel, panel);
mainPanel.revalidate();
mainPanel.repaint();
}
But I don't see the Table
. I believe as the object of BrowseListPanel
(containing the JTable
) is already created & later the TableModel
is added. So some sort of event should be fired in setTModel()
.
Am I right? If so, what event should be thrown and what should be its implementation.