Nebula ViewerCell with custom image [message #57177] |
Wed, 06 August 2008 12:28 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: johnny.hensegard.telia.com
Hi,
I'm trying to print an image to a cell in the nebula grid.
I've tried two ways without success. Or maybe there is another way??
1.
Using the method ViewerCell.setImage(Image)
My problem here is that the image will not cover the whole cell,
the cell always puts a block of white space to the left of the image
(I have tried with bigger width than the cell has with the same result)
Example code:
GridViewerColumn col = new GridViewerColumn(viewer, SWT.NONE);
col.getColumn().setWidth(30);
col.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
cell.setImage(new Image(Display.getDefault(), imageData));
}
});
2.
Using the GC to instead of setImage in the code below
GC gc = new GC(viewer.getGrid());
gc.setBackground(Display.getDefault().getSystemColor(SWT.COL OR_BLUE));
gc.fillRectangle(cell.getBounds());
gc.dispose();
This will flash the color once and then replace it with the original table
Cheers
/Johnny
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02939 seconds