jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Can't clear highlight in JTable cell Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Can Watch "Can New topic

Can't clear highlight in JTable cell

Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
After I click on cell(6, 3) to select that flight, and purchase my tickets, I reread from the database (according to the existing search criteria), and display the updated data.
However, cell(6, 3) will still have a highlight after I'm "done." clearSelection() methods don't seem to do anything... what's going on?
I can write an HTML background color into that cell to gloss over the problem, but that's a kludge.

Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
Stephane Weber
Ranch Hand

Joined: Mar 07, 2002
Posts: 110
In my case, after each booking I call a method 'refreshSearch' that will reread from database and update the display.
basically it contains this :

And this makes the selection disappear after the booking.
Hope this helps
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Hmm... thanks. I found that I can also do:but that still doesn't seem to address the issue surgically...
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Whenever I had changes to maketo the JTable, I just created a new instance of my TableModel and used setTableModel method of the JTable, and that worked.
I never had to change or code change the row or column that was selected.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Well, as an addendum:
I had been using j2sdk1.4, and only just converted to 1.3.
The problem disappeared entirely with 1.3...
but of course the fonts all now look like gopher poop.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451

but of course the fonts all now look like gopher poop.

Makes good fertilizer

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I agree. Here's the link: http://aspose.com/file-tools
subject: Can't clear highlight in JTable cell
It's not a secret anymore!