Changes

Jump to: navigation, search
4.b. Add Image to the Menu
==== 4.b. Add Image to the Menu ====
4.b.1. Add static fields for menu item number:<br/><source lang="java">final static int MENU_ADD = 0;  final static int MENU_EDIT = 1; final static int MENU_DELETE = 2; final static int MENU_EMAIL = 3; final static int MENU_MAP = 4;</source> 4.b.2. Create an abstract class that extends MenuItem to be used for creating items with image:<br/>
<source lang="java">
/**
</source>
 4.b.23. Change the instantiation of menu items to use the new class created ''ImageMenuItem'', pass the name of the menu item to the constructor:<br/>
<source lang="java">
 
ImageMenuItem addItem = new ImageMenuItem("Add Student", 100, 1, MENU_ADD);
addItem.setCommand(new Command(new CommandHandler() {
</source>
 [[Image: BB_MenuBB_MenuImage.png | 300px]]<br/>
1
edit

Navigation menu