The initial problem is to update JTable when user opens file from my
JMenuBar
I handle JMenuBar events by implementing AbstractAction
My JTable has its own implementation of TableModel (I extend
DefaultTableModel)
The JTable itself is added into the JPanel that resides within the
JFrame that actually holds,the described above JMenuBar, I know its
getting too confusing, so I'll try to visualize my words
---------------------------------
| MyJMenuBar
| -------------------------------
| MyJPanel
| ------------------------------
| |JTable
| |*************************
| |* MyTableModel is here *
| |*************************
So how to I update my JTable when user clicks File > Open on JMenuBar?
There is one hack I think about right now. In File-Open handler I can
add the following line of code
SwingUtilities.windowForComponent(MyJMenuBar.this).getMyJPanel().getJTable().setNewModel(new
MyTableModel());
Frankly I don't like this approach, because I don't think its good to
make my JMenuBar to be aware of MyTableModel, so I desperately need
somebody's help and advice.
Thanks a lot beforehand!