< Day Day Up > |
Recipe 9.9 Creating Image Menu Items9.9.1 ProblemYou want to display images in menu items. 9.9.2 SolutionUse the MenuItem class's setImage method. 9.9.3 DiscussionYou can pass an Image object to a MenuItem object's setImage method to add an image to a menu item. Here's an example: Display display = new Display ( ); final Image image = new Image (display, "c:\helpitem.jpg"); . . . menuItem.setImage(image); 9.9.4 See AlsoRecipe 9.7 on creating a menu system; Recipe 9.8 on creating text menu items; Recipe 9.10 on creating radio menu items; Recipe 9.11 on creating menu item accelerators and mnemonics; Recipe 9.12 on enabling and disabling menu items; Chapter 8 in Eclipse (O'Reilly). |
< Day Day Up > |