Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JTable - DefaultTableModel

Reply
Thread Tools

JTable - DefaultTableModel

 
 
pat270881
Guest
Posts: n/a
 
      04-11-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to implement an undeditable JTable without overriding class DefaultTableModel clusardi2k@aol.com Java 0 09-12-2012 04:25 PM
no method to remove all rows from DefaultTableModel Parvinder Java 2 06-15-2012 05:14 PM
DefaultTableModel Cyril Dex Java 2 09-21-2004 10:24 AM
ArrayIndexOutOfBoundsException with DefaultTableModel Aloys Oberthuer Java 3 04-22-2004 04:32 PM
JTable - using DefaultTableModel - How do I make the table cells uneditable Deshaies Java 3 04-20-2004 04:00 PM



Advertisments