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 2007

Tip: Looking for answers? Try searching our database.

Changing color of a selected cell in JTable

Thread view: 
Chanchal - 10 Dec 2007 09:11 GMT
Hi All,

        I do not know if this is a cross-posting. I have searched the
groups and couldn't find the info i wanted.

Apologies over, my problem is that, i want to change the color of a
JTable cell which is selected. Selection can happen by mouse click or
using arrow keys or tab key.

Kindly advice. Thanks  in advance

Chanchal
Tom N - 10 Dec 2007 10:16 GMT
> Apologies over, my problem is that, i want to change the color of a
> JTable cell which is selected. Selection can happen by mouse click or
> using arrow keys or tab key.

Different look-and-feels do this differently.  You could change to a
different look-and-feel to see if it matches what you want.

You can subclass DefaultTableCellRenderer and get complete control.  Your
JTable subclass should override
       getCellRenderer(int row, int column)
or you may be able to use
       setDefaultRenderer(Class columnClass, TableCellRenderer renderer)
on a straight JTable.
Andrew Thompson - 10 Dec 2007 11:49 GMT
>>...want to change the color of a
>> JTable cell which is selected. Selection can happen by mouse click or
>> using arrow keys or tab key.
>
>Different look-and-feels do this differently.  You could change to a
>different look-and-feel to see if it matches what you want.

Have you checked it, for e.g.* using the system PLAF?

<http://www.physci.org/test/resize/>

Signature

Andrew Thompson
http://www.physci.org/

Chanchal - 10 Dec 2007 12:30 GMT
Hello Gentlemen,

My application is already using a look and feel. So changing the look
and feel is not an option. Anyway i have implemented it by creating a
custom cell renderer

Thanks agan, for the response

Chanchal


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.