On Sat, Jun 20, 2009 at 12:17 PM, Tony Tambasco <[email protected]> wrote:
> Hey gang, > > I'm hoping one of you might be enough of a Swing guru to either help me or > point me in the direction of a good resource on this one. I'm developing an > application that is going to use a jTable. When the app starts, the table is > blank. If you open a file (XML), it parses the entries and populates the > table. Alternatively, you can click a button to add a row to or remove it > from the table. > > I haven't touched java in a while, and I was never very well acquainted > with Swing, so any help is greatly appreciated. I have found some things > online, but nothing yet that really seems to apply. Complicating the issue > slightly is that I'm developing with NetBeans, which won't let me edit > certain auto generated code. > Tony, Its been a few years since I've done Swing development (and to be honest, I kind of miss it!), but I've done a pretty good amount of it and can hopefully be of help to you. The swing components consist of two parts, the view and the controller. In your case you'll have a jtable and a table model. As I recall there are some default table models, but depending on the complexity of your data model you may want to define your own. All of the logic to add/remove/update rows goes into the model. The model then fires events which the jtable will respond to by updating itself. If you have specific example that you'd like to share, just post them to www.pastebin.com and I'll be happy to have a look Kevin
