Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   JTable - DefaultTableModel (http://www.velocityreviews.com/forums/t142628-jtable-defaulttablemodel.html)

pat270881 04-11-2005 10:33 AM

JTable - DefaultTableModel
 
Hello,

I have a JTable with a DefaultTableModel. I have a search Methode which
searches in the database and displays the results in the JTable. Now I
want to extract the search from the class and put it in an extra class.
I have for both the JTable and the DefaultTableModel defined getters
and setters and now I want to write the following code in the
outsourced method:

Search.getTable().setVisible(true);
search.getModel().addRow(new Object[]{name,text});

Search is the class where the JTable and the DefaultTableModel is
defined. Both lines are in a loop of a Vector size and the data of the
vector are in the name and text parameters of the addRow Method. The
problem is that this does not work and the rows are not displayed when
I start my Java Application. When I put this code (without the Search
prefix and the get-Method) it works without problems.

Is it not possible to address the table and the model in that way from
another class?

lg



All times are GMT. The time now is 08:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.