Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2005

Tip: Looking for answers? Try searching our database.

Overwritten Boolean in table cell

Thread view: 
jupiter49 - 29 Dec 2005 01:35 GMT
Hi guys,
I'm using Swing to create a JTable with one column rendering a checkbox
(Boolean).  Fine, this works because I have a custom table model that
overrides getColumnClass() and now everybody is happy figuring out how to
render a Boolean.

Now I'm not happy with white background so I create a new renderer class,
and I myTable.setDefaultRenderer(Boolean.class, new BooleanClassRenderer().
Fine, now I get my pretty color background.

But ....... (the big but)  that pretty background overwrites the checkbox
which is now hidden until you use the editor to MouseDown on the cell. Then
the checkbox appears visible until you MouseUp.

How is this happening and how can I prevent it?   I've tried a number of
things like new Boolean(true) in the renderer *after* setting the
background.  This has me stumped and I don't know where to look for help.

Any ideas?
hiwa - 29 Dec 2005 02:33 GMT
A stab in the dark:
Your cell renderer method doesn't return a check box.
jupiter49 - 29 Dec 2005 18:13 GMT
> A stab in the dark:
> Your cell renderer method doesn't return a check box.

Yep, I tried that.  Same result.  The JCheckbox is only visible is you
MouseDown on the cell.

I tried setBackground(Color.WHITE) and even that overwrote the checkbox.  I
have to let the default renderer paint it or it just doesn't happen right.

I think I already tried extending default renderer and using
super.setBackground() but it was the same result.
hiwa - 30 Dec 2005 04:04 GMT
Smells your renderer code is wrong.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.