The moose likes Swing / AWT / SWT and the fly likes Updating values in a jTable 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 » Swing / AWT / SWT
Bookmark "Updating values in a jTable" Watch "Updating values in a jTable" New topic

Updating values in a jTable

Tore Julø

Joined: Apr 01, 2009
Posts: 2

Here's the situation.
We're doing a hotel booking system for a school project and we need to retrieve a list of available rooms for a give period of time.
Rooms, bookings and so on are retrieved from a database, and the logic for that seems to be working, only the jTable that is supposed to display the values doesn't update.

I hope you guys can help.

Here's the code for the panel that contains the table:

Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

Without the code of MyModel I doubt we can say anything useful. I see no updates made to the table / model in the code you posted.

How To Ask Questions How To Answer Questions
Tore Julø

Joined: Apr 01, 2009
Posts: 2
Isn't it ok to embed it in the jPanel?
This is on line 166 in the code I pasted :

It's calling mappingArray, which is located in a class with the somewhat awkward name of BookingRoomController.

And it does seem to work, because when jPanel instantiates the table looks as expected. What remains now is figuring out how to update the actual table, because I'm fairly certain that we're getting the correct data when pressing the ok-button (see line 136).
I've read about fireTableDataChanged and newDataAvailable, but I'm not sure where and how to implement them.
I agree. Here's the link: http://aspose.com/file-tools
subject: Updating values in a jTable
Similar Threads
First GUI program
Refresh Jtable went you press update button
Project Problems - Help ASP
How to show the data in JTable using RandomAccessFile as well add, delete, update function