Accessing the associated dataModel when a particular frame is selected
From: Bob Wightman (aqvi55_at_dsl.pipex.com)
Date: 12/31/03
- Next message: ak: "Re: Accessing the associated dataModel when a particular frame is selected"
- Previous message: Todd Corley: "Re: Center text in a JLabel?"
- Next in thread: ak: "Re: Accessing the associated dataModel when a particular frame is selected"
- Reply: ak: "Re: Accessing the associated dataModel when a particular frame is selected"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Dec 2003 07:43:34 -0800
I have JDesktop containing one or more JInternalFrames. Each of these
frames contains a JScrollPane which in turn contains a JTable, each
with its own tableModel. I wish to add a row to the table in the
currently selected frame. How do I recover the tableModel to do this?
I can do it if I only have a single table using:
table.getModel().addRow(item);
but it would be easier for my end users if they could have multiple
tables open. The tables all have the same structure but have differing
numbers of rows. I also may need to edit existing items in the tables.
In line with the MVC architecture of Swing, it appears as if I am
trying to get to the model through the view rather than keeping the
model separate. This implies that I should keep a list (collection?)
of each model as I create it in my application. The difficulty then
becomes associating the currently selected view with the appropriate
model so that the editing is done in the appropriate table.
Any ideas or suggestions?
Oh, and a happy new year to everyone :-)
Bob
- Next message: ak: "Re: Accessing the associated dataModel when a particular frame is selected"
- Previous message: Todd Corley: "Re: Center text in a JLabel?"
- Next in thread: ak: "Re: Accessing the associated dataModel when a particular frame is selected"
- Reply: ak: "Re: Accessing the associated dataModel when a particular frame is selected"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]