Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Coloring cell background in JFace tables
Coloring cell background in JFace tables [message #193316] Tue, 18 January 2005 14:41 Go to next message
Eclipse UserFriend
The author of the following describes how to set the background color of a
row in a table using an undocumented feature in the JFace table viewer
(thank you for provding this!).

http://wiki.schubart.net/wiki/wiki.phtml?title=How_to_Color_ Rows_in_a_TableViewer&printable=yes

In a nutshell, you implement both ITableLabelProvider AND IColorProvider
in your label provider class. IColorProvider has you implement
getBackground and getForeground methods. They don't know which column it
is, so with these you affect an entire row.

Can anyone describe how to do this for a single cell?

We've tried but have been unable to make an image on the fly in
getColumnImage(). Can anyone provide a snippet of code that does this?
Re: Coloring cell background in JFace tables [message #193392 is a reply to message #193316] Wed, 19 January 2005 07:13 Go to previous message
Eclipse UserFriend
Questions to jFace classes should be asked on the eclipse.platform newsgroup.

To color individual cells, use an ITableColorProvider.

Markus


Bill Ewing wrote:
> The author of the following describes how to set the background color of
> a row in a table using an undocumented feature in the JFace table viewer
> (thank you for provding this!).
>
> http://wiki.schubart.net/wiki/wiki.phtml?title=How_to_Color_ Rows_in_a_TableViewer&printable=yes
>
>
> In a nutshell, you implement both ITableLabelProvider AND IColorProvider
> in your label provider class. IColorProvider has you implement
> getBackground and getForeground methods. They don't know which column
> it is, so with these you affect an entire row.
>
> Can anyone describe how to do this for a single cell?
>
> We've tried but have been unable to make an image on the fly in
> getColumnImage(). Can anyone provide a snippet of code that does this?
>
Previous Topic:Trouble getting a class onto the buildpath
Next Topic:Tabs or Spaces
Goto Forum:
  


Current Time: Mon Apr 28 02:44:14 EDT 2025

Powered by FUDForum. Page generated in 0.02297 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top