• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. SWT Trees > Changing the Image When the Item Is Expanded

13.6. Changing the Image When the Item Is Expanded

Of course, to mimic Windows Explorer you need to change the image when an item with children is expanded: the "Closed" folder should be displayed when the tree is collapsed and the "Open" folder displayed when the tree is expanded.

13.6.1. How do I do that?

To use an image with a collapsed node that's different from images used with expanded nodes, you need a mechanism to determine the state of the item. You must also capture the event that occurs when the item changes state. Fortunately, the SWT provides a listener type designed specially for these events—the TreeListener .


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint