[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] Re: Can I put more than one images in a jface table view's cell?
|
You can't add more than one image to a table cell, but you can combine
images (remember however, that the image that is first set determines the
size for the rest, so overlaying stuff later which would make an image wider
is not an option. In that case, use transparent image for overlay).
I've attached code to create an OverlayIcon (combined image of other
images). It was posted somewhere a long time ago in this newsgroup, I think.
Basically, you use it by:
ImageDescriptor firstImage = your first image...
ImageDescriptor secondImage = second image...
(and more images if you want)
OverlayIcon oc = new OverlayIcon(firstImage, new ImageDescriptor [] {
secondImage }, new int [] { OverlayIcon.TOP_RIGHT }, new Point(32, 16));
Image putInCell = oc.createImage();
As you can probably tell, that'll combine the first image with the second,
putting the second in the top right, and the image is now 32x16 pixels.
Hope that's what you're after.
Emil
"jason, nie" <nielinjie@xxxxxxxx> wrote in message
news:cc660c21bb592923882cdc5dcd18e623$1@xxxxxxxxxxxxxxxxxx
> Hi all,
> I just want to put a few images into a jface table view's cell, (they are
> all 16*16).
> But ITableLabelProvider only allow one image for a cell, can you help me?
> And also, I tried to create a new image to put in (new image is
> 16*numOfImages*16), this image displayed in the cell, but it is stretched
> to 16*16. Can jface table view display a non-square image?
>
> thanks
>
begin 666 OverlayIcon.java
M<'5B;&EC(&-L87-S($]V97)L87E)8V]N(&5X=&5N9',@0V]M<&]S:71E26UA
M9V5$97-C<FEP=&]R('L-"@DO+R!T:&4@8F%S92!I;6%G90T*"7!R:79A=&4@
M26UA9V4@8F%S93L-"@DO+R!T:&4@8F%S92!A<R!A(&1E<V-R:7!T;W(-"@EP
M<FEV871E($EM86=E1&5S8W)I<'1O<B!D97-C<FEP=&]R0F%S93L-"@DO+R!T
M:&4@;W9E<FQA>2!I;6%G97,-"@EP<FEV871E($EM86=E1&5S8W)I<'1O<EM=
M(&]V97)L87ES.PT*"2\O('1H92!S:7IE#0H)<')I=F%T92!0;VEN="!S:7IE
M.PT*"2\O('1H92!L;V-A=&EO;G,-"@EP<FEV871E(&EN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