How do I change the background selection color for a jface table

ks. picture ks. · May 26, 2009 · Viewed 11.1k times · Source

In a elipse-rcp application I am setting the background color for a row in a jface table but I don't want the selection to change this color. I want to be able to specify the color change for a selected row.

Answer

VonC picture VonC · May 26, 2009

According to this thread, for JFace Viewers (ListViewer, Table, Tree) by means of using EraseItem and MeasureItem events

General principle detailed in the article "Custom Drawing Table and Tree Items"

SWT.EraseItem: allows a client to custom draw a cell's background and/or selection, and to influence whether the cell's foreground should be drawn

alt text