aspose file tools*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Can Watch "Can New topic
Author

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
Hi,
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
Stephane
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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can't clear highlight in JTable cell