aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How do I call this JTable TableModel method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do I call this JTable TableModel method?" Watch "How do I call this JTable TableModel method?" New topic
Author

How do I call this JTable TableModel method?

Sean Gildea
Ranch Hand

Joined: Jul 01, 2004
Posts: 81
How do I call the method addCruiseListing defined in my custom TableModel so my JTable displays data?

Also, how can I call it later on as well?




SCJD, SCBCD, SCJP
Matthew Taylor
Rancher

Joined: Jun 13, 2004
Posts: 110
I would create the TableModel as an attribute in the TableDemo class.

Declare the MyTableModel so the whole class can see it.

Create the MyTableModel object and send it to the JTable for construction.

Now you can create a getter method in the TableDemo class that returns the model it's using:

And just use this line wherever you want to use a MyTableModel method:


Grails Consultant
http://dangertree.net
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I call this JTable TableModel method?