Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table Header background is white(able not provide styling or color for table header & rows)
Table Header background is white [message #1806490] Thu, 09 May 2019 15:12
Eclipse UserFriend
Using ice Window Manager with Oracle Linux 7 - 64bit with a basic SWT Table. There is not any styling or color for table header, or vertical lines between columns.

Can someone point me to where the problem on my system might be?
See attached image
index.php/fa/35531/0/

Here is the code:
package colortest;

import org.eclipse.swt.SWT;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.wb.swt.SWTResourceManager;

public class colorShell extends Shell {
	private Table table;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String args[]) {
		try {
			Display display = Display.getDefault();
			colorShell shell = new colorShell(display);
			shell.open();
			shell.layout();
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
					display.sleep();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the shell.
	 * @param display
	 * 
	 * 
	 * 
	 */
	public colorShell(Display display) {
		super(display, SWT.SHELL_TRIM);
		
		table = new Table(this, SWT.BORDER | SWT.FULL_SELECTION| SWT.HIDE_SELECTION );
		table.setBounds(36, 40, 359, 187);
		table.setBackground(SWTResourceManager.getColor(23));
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		
		
		TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
		
		tblclmnNewColumn.setWidth(100);
		tblclmnNewColumn.setText("col1");
		
		
		TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_1.setWidth(100);
		tblclmnNewColumn_1.setText("col2");
		
		TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
		tblclmnNewColumn_2.setWidth(100);
		tblclmnNewColumn_2.setText("col3");
		
		
		
		TableItem tableItem = new TableItem(table, SWT.NONE);
		//tableItem.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
		tableItem.setText("New TableItem");
		
		
		TableItem tableItem_1 = new TableItem(table, SWT.NONE);
		//tableItem_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
		tableItem_1.setText("New TableItem");
		
		TableItem tableItem_2 = new TableItem(table, SWT.NONE);
		//tableItem_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
		tableItem_2.setText("New TableItem");
		
		table.pack();
		createContents();
	}

	/**
	 * Create contents of the shell.
	 */
	protected void createContents() {
		setText("SWT Application");
		setSize(450, 300);

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}



Thanks,
Don
  • Attachment: pic6.bmp
    (Size: 352.65KB, Downloaded 174 times)
  • Attachment: table.jpg
    (Size: 12.23KB, Downloaded 1138 times)
Previous Topic:Access "VSplit" system cursor (Windows)
Next Topic:Howto run SWT 3.7 (Eclipse Indigo) under Mac OS X 10.14
Goto Forum:
  


Current Time: Sat Jul 12 21:09:19 EDT 2025

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

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

Back to the top