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 Developer Certification (SCJD/OCMJD) and the fly likes update data in the 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 » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "update data in the JTable" Watch "update data in the JTable" New topic
Author

update data in the JTable

Jofer Chan
Ranch Hand

Joined: Sep 09, 2003
Posts: 49
Hi,everyone:
sorry my English.
I booked a record in client,
this record is updated succeed,
does need to update the data in the JTable?
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
Jofer,
You should notify the TableModel that the data has been updated. Check the Javadoc for AbstractTableModel, which I assume you are extending either directly or through DefaultTableModel, to find out how.


kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
If the record is successfully booked, do I need to make it disappear from JTable? I personally think that booked records need to be removed from table. What do you think?
Thanks!
Seid
[ December 11, 2003: Message edited by: Seid Myadiyev ]

Seid Myadiyev<br />SCJP, SCWCD, SCBCD, SCEA-Part 1
Miguel Roque
Ranch Hand

Joined: Oct 24, 2002
Posts: 126
Hi.
I don't think that you should remove any record from the JTable even if the available seats are 0. I've made like this and if the available seats where 0 the book seat button was disabled for that specific row in the JTable.
Miguel
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
Hi Miguel,
Does your previous post also mean that after find method returns even booked rooms appear in the table but they cannot be booked because book button becomes disabled when book record is selected?
Do you let the user know why your book button is disabled, by means of ToolTip over booked record, for example?
Thanks!
Seid
[ December 11, 2003: Message edited by: Seid Myadiyev ]
Miguel Roque
Ranch Hand

Joined: Oct 24, 2002
Posts: 126
Hi.
Does your previous post also mean that after find method returns even booked rooms appear in the table but they cannot be booked because book button becomes disabled when book record is selected?

Yes
Do you let the user know why your book button is disabled, by means of ToolTip over booked record, for example?

I have put only a tooltip informing what the button does, that is, reserves seats (it was the fly by night assignment, but is similar to this one) and if no seats where available 0 was presented in the JTable and the button becomes disabled without changing the tooltip.
Miguel
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
Miguel,
I am sorry, to ask again, I am just trying to understand your design.
If your find method returns booked records as well doesn't it then return all records?
Thanks!
Seid
Jianhua Ren
Greenhorn

Joined: Oct 19, 2003
Posts: 26
I think Miguel means that when you especially select one row, his program will check the seats availability for that entry, if no seats are available, book button is disabled; if seats are available, book button are enabled.
Miguel wrote:
I've made like this and if the available seats where 0 the book seat button was disabled for that specific row in the JTable

Regards,
Jianhua
[ December 11, 2003: Message edited by: Jianhua Ren ]
Seid Myadiyev
Ranch Hand

Joined: Jul 02, 2002
Posts: 196
Thank you, Jianhua!
Seid
[ December 11, 2003: Message edited by: Seid Myadiyev ]
Miguel Roque
Ranch Hand

Joined: Oct 24, 2002
Posts: 126
Hi.
Originally posted by Seid Myadiyev:
Miguel,
I am sorry, to ask again, I am just trying to understand your design.
If your find method returns booked records as well doesn't it then return all records?
Thanks!
Seid

In my design, that was the FlyByNight assignment, the find method allways return the flights from one destination to other even if no seats were available.
I think Miguel means that when you especially select one row, his program will check the seats availability for that entry, if no seats are available, book button is disabled; if seats are available, book button are enabled.

That's it. In the JTable, one of the columns shows the available seats. When one row is selected, it reads the available seats and if it's 0 then the button is disabled. It's simple but it doesn't give you milions .
Miguel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: update data in the JTable
 
Similar Threads
Multiple or Single updates from JTABLE?
Populating JTable
Jtable
jtable
update a JTable