Home » Eclipse Projects » Eclipse Platform » JFace table : getColumnImage can't return different sized images?
JFace table : getColumnImage can't return different sized images? [message #327354] |
Wed, 16 April 2008 10:00 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Toby Weston![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=toby.weston%40gmail.com) Messages: 22 Registered: July 2009 |
Junior Member |
|
|
Hi Folks,
Have a strange problem with my first ITableLabelProvider implementation, in the getColumnImage method I create an Image and use the GC to draw to it directly, all seems fine until I want to create images of different sizes between columns.
The following snippet demonstrates the problem. Basically, if in the first column a set an image size of 100x50, the second column's image will somehow use that size, even though I create the image as 50x50.
Any ideas? The code below is a cut down version, I've been doing the image creation in its own method and using the image registry to keep hold of them.
Any ideas would be most appreciated, this is driving me mad!
<pre>
public Image getColumnImage(Object element, int columnIndex) {
Image image = null;
GC gc = null;
switch (columnIndex) {
case 0:
image = new Image(getDisplay(), 100, 50);
gc = new GC(image);
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED)) ;
gc.fillRectangle(0, 0, 100, 50);
gc.drawLine(0, 0, 100, 50);
gc.dispose();
return image;
case 1:
image = new Image(getDisplay(), 50, 50);
gc = new GC(image);
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED)) ;
gc.fillRectangle(0, 0, 50, 50);
gc.drawLine(0, 0, 50, 50);
gc.dispose();
return image;
}
return null;
}
</pre>
Thanks
|
|
|
Re: JFace table : getColumnImage can't return different sized images? [message #327355 is a reply to message #327354] |
Wed, 16 April 2008 10:03 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Thomas Schindl![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=tom.schindl%40bestsolution.at) Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
SWT-Table/Tree don't support different sizes. If you want to draw
different sized images you'll have to use the custom drawing.
Tom
Toby Weston schrieb:
> Hi Folks,
>
> Have a strange problem with my first ITableLabelProvider implementation, in the getColumnImage method I create an Image and use the GC to draw to it directly, all seems fine until I want to create images of different sizes between columns.
>
> The following snippet demonstrates the problem. Basically, if in the first column a set an image size of 100x50, the second column's image will somehow use that size, even though I create the image as 50x50.
>
> Any ideas? The code below is a cut down version, I've been doing the image creation in its own method and using the image registry to keep hold of them.
>
> Any ideas would be most appreciated, this is driving me mad!
> <pre>
> public Image getColumnImage(Object element, int columnIndex) {
> Image image = null;
> GC gc = null;
> switch (columnIndex) {
> case 0:
> image = new Image(getDisplay(), 100, 50);
> gc = new GC(image);
> gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED)) ;
> gc.fillRectangle(0, 0, 100, 50);
> gc.drawLine(0, 0, 100, 50);
> gc.dispose();
> return image;
> case 1:
> image = new Image(getDisplay(), 50, 50);
> gc = new GC(image);
> gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED)) ;
> gc.fillRectangle(0, 0, 50, 50);
> gc.drawLine(0, 0, 50, 50);
> gc.dispose();
> return image;
> }
> return null;
> }
>
> </pre>
> Thanks
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
| | | | | |
Goto Forum:
Current Time: Sat Aug 17 14:25:08 GMT 2024
Powered by FUDForum. Page generated in 0.03639 seconds
|