How to change SWT Tree plus / minus icons

I am working on a SWT tree similar to here , however I want to be able to show + signs in some cases instead of - for an extended tree element. Is it possible?

If not, does the Windows API have custom icons for the expanded / collapsed state of a tree item?

+6
java swt treeview
source share
1 answer

The SWT Tree component uses its own Tree widget, if it is available, for example, in the case of Windows - it uses its own widget located in Linux (depending on the user interface mechanism used), it can create its own tree on its own.

On an OS where it uses its own Tree widget, it is not possible to configure the + and - icons.

As Ali suggested (see http://msdn.microsoft.com/en-us/library/bb773568%28VS.85%29.aspx ), you can use TVE_EXPANDPARTIAL , but keep in mind that the code will depend on the OS ( even on Windows versions).

You may, however, wish to use a custom image β€” using the getImage() method in TreeContentProvider to specify otherwise, rather than relying on TVE_EXPANDPARTIAL . It also ensures that your code is OS independent.

+2
source share

All Articles