SWT table header height with cross-platform image

Java SWT table

I have added an image along with text for each column in my table.

The table displays fine on Windows and Linux, however on Mac Java does not use an image to resize the table header. Is there a job or a trick?

...
// Create the table columns.
TableViewer oTableViewer = new TableViewer(oSash, SWT.BORDER | SWT.MULTI);
Table oTable = oTableViewer.getTable();
...
oTable.setHeaderVisible(true);
TableColumns[] oColumns = new TableColumn[3];
for (int iColumn = 0; iColumn < oColumns.length; iColumn++)
    oColumns[iColumn] = new TableColumn(oTable, SWT.NONE);

...
Image imgCol1 = new Image(display, oStream);
Image imgCol2 = new Image(display, oStream);
Image imgCol3 = new Image(display, oStream);

// Set the column widths and names.
oColumns[0].setText("My 1st Column");
oColumns[0].setWidth(100);
oColumns[0].setImage(imgCol1);
oColumns[1].setText("My 2nd Column");
oColumns[1].setWidth(100);
oColumns[1].setImage(imgCol2);
oColumns[2].setText("My 3rd Column");
oColumns[2].setWidth(100);
oColumns[2].setImage(imgCol3);

      

I am using Eclipse Luna.

The Mac in question has the latest JDK, v8. I downloaded the JDK on Mac last week, so last week was the latest and greatest 64-bit JDK.

Oh, I took a look at this question on Stackoverflow, but it didn't sadly talk about images.

+3


source to share





All Articles