SWT: draw “icons” in the cells of a table or tree

We have a Swing application that we plan to transfer to SWT / JFace. The Swing application draws many icons ( javax.swing.Iconimplementations) in trees and tables (the icon to the left of the text). If I understand correctly, SWT can only draw images (aka graphic files). What would be the easiest solution to draw an icon or an entire cell in a table / tree? Thanks in advance.

+3
source share
1 answer

Images can be loaded from image files or they can be drawn in memory.

Image image = new Image(Display.getCurrent(), width, height);
GC gc = new GC(image);

// draw icon using GC

gc.dispose();

/, table/tree:

TableItem item = ...
item.setImage(theImage);

: Windows . , , . , .

, .

, , API /, , .

+3

Source: https://habr.com/ru/post/1779819/


All Articles