Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Transparency in TableItems
Transparency in TableItems [message #1690286] Thu, 26 March 2015 10:57 Go to next message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
SWT supports transparency in many controls which is great. In our application we would like to have table items with a slightly transparent background color. This does not work as far as I can see. Here is a snippet that sets different alpha values on each item - but they all look the same:

package snippets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

public class SnippetTransparency {
    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());

        Table table = new Table(shell, SWT.NONE);
        Color[] colors = new Color[256];
        for (int i = 0; i < 256; i++) {
            TableItem item = new TableItem(table, SWT.NONE);
            item.setText("Item " + i);
            colors[i] = new Color(display, new RGBA(255, 0, 0, i));

        shell.setSize(100, 400);;
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
        for (Color color : colors) {

On macosx and on windows there is no transparency in the table items. Is it generally not possible to make this work or is it just not yet implemented?

Best regards,
Re: Transparency in TableItems [message #1690639 is a reply to message #1690286] Mon, 30 March 2015 09:47 Go to previous message
Niraj Modi is currently offline Niraj ModiFriend
Messages: 48
Registered: November 2013
Hi Peter,
Thanks for trying this feature. Currently, SWT honors only extreme values for alpha i.e, '0'(transparent) or '255'(opaque).
And setting transparent background color for some controls works on GTK3 only, it fails on other platforms. For e.g. Table, Tree.

Please refer complete documentation of this feature here:
Previous Topic:SWT FileDialog
Next Topic:Need to make Plugin in Eclipse with Docking Window using SWT
Goto Forum:

Current Time: Mon Jan 25 08:51:11 GMT 2021

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

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

Back to the top