[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] Re: Images in Tree
|
The only way to do this is to merge the two images into one:
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
Image image1 = new Image(display,
Main.class.getResourceAsStream("a.gif"));
Image image2 = new Image(display,
Main.class.getResourceAsStream("b.gif"));
Rectangle size1 = image1.getBounds();
Rectangle size2 = image2.getBounds();
Image image3 = new Image(display, size1.width + size2.width,
Math.max(size1.height, size2.height));
GC gc = new GC(image3);
gc.drawImage(image1, 0, 0);
gc.drawImage(image2, size1.width, 0);
gc.dispose();
image1.dispose();
image2.dispose();
Table table = new Table(shell, SWT.FULL_SELECTION | SWT.MULTI |
SWT.BORDER);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn column1 = new TableColumn(table, SWT.NONE);
column1.setText("column 1");
TableColumn column2 = new TableColumn(table, SWT.NONE);
column2.setText("column 2");
for (int i = 0; i < 10; i++) {
TableItem item = new TableItem(table, SWT.NONE);
item.setText(new String[] {"item " + i, "second column "+i});
item.setImage(image3);
}
column1.pack();
column2.pack();
shell.pack ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
image3.dispose();
display.dispose ();
}
"Antonio Navarro" <anavarrog@xxxxxxxxxx> wrote in message
news:bai7u5$8bc$1@xxxxxxxxxxxxxxxx
> I'm trying to do this too, if you find a solution please, tell me. Thanks.
>
> "Mavi" <mavirando@xxxxxxxxxxx> escribió en el mensaje
> news:bai2o4$3ig$1@xxxxxxxxxxxxxxxx
> > Hi,
> > I would like to put to the left of the text of a tree node more than one
> > image. I'm using a TreeViewer.
> > Thank You.
> >
> >
>
>