This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Updating JTable data sources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Updating JTable data sources" Watch "Updating JTable data sources" New topic
Author

Updating JTable data sources

Aran Winters
Greenhorn

Joined: Nov 23, 2003
Posts: 11
This is my first post - if this question is better suited to the intermediate forum, I apologize and will take it there.
I'm having difficulty getting my table to refresh its data model and itself (appearance wise).
I'm using a DefaultTableModel which is constructed with 2 Vectors.
1 is the data Vector, the other for the column headings.
To begin, I start my application with an empty data Vector, so the
table is displayed as empty - fine no problems.
Next I have a button which adds an entry to the data Vector, and also
generates an event for the table.
To construct the event (TableModelEvent), I pass it my table model.
Then I have used both newRowsAdded() and newDataAvailable() to deliver
the event.
I do have a TableModelListener, and the gist of what is does is an
addRow() where I pass it the new row data.
Here's the problematic behaviour - When I use the GUI to update the
table, it enters the 1 row of data over and over again (maybe 32k times).
I would appreciate any insights, or feedback. Thanks.
Tobias Hess
Ranch Hand

Joined: Apr 06, 2004
Posts: 55
You have created a loop. Post some code, please.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / JFC / AWT forum...
[ April 06, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updating JTable data sources
 
Similar Threads
Clearing data from a jTable
Problem with a jtable
JTable remove rows trouble.
Populating data into JTable
Updating JTable data sources