Recipe 10.8 Adding Images to Tree Items

     

10.8.1 Problem

You want to add images to tree items.

10.8.2 Solution

Use the TreeItem class's setImage and getImage methods .

10.8.3 Discussion

To install an image for a tree item, pass the setImage method a new Image object. To see how to create Image objects, take a look at the Recipe 9.9 in Chapter 9. To get the image from a tree item, use the getImage method.

10.8.4 See Also

Recipe 9.9 on creating image menu items; Recipe 10.5 on creating trees in SWT; Recipe 10.6 on handling tree events; Recipe 10.7 on adding checkboxes to tree items.



Eclipse Cookbook
Inside XML (Inside (New Riders))
ISBN: 596007108
EAN: 2147483647
Year: 2006
Pages: 232
Authors: Steve Holzner

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net