Search in sources :

Example 1 with Menu

use of net.rim.device.api.ui.component.Menu in project CodenameOne by codenameone.

the class BlackBerryCanvas method getMenu.

public Menu getMenu(int val) {
    if (Display.getInstance().getCommandBehavior() == Display.COMMAND_BEHAVIOR_NATIVE) {
        m = new Menu();
        if (commands != null) {
            for (int iter = 0; iter < commands.size(); iter++) {
                final Command cmd = (Command) commands.elementAt(iter);
                String txt = UIManager.getInstance().localize(cmd.getCommandName(), cmd.getCommandName());
                MenuItem i = new MenuItem(txt, iter, iter) {

                    public void run() {
                        Display.getInstance().callSerially(new Runnable() {

                            public void run() {
                                impl.getCurrentForm().dispatchCommand(cmd, new ActionEvent(cmd));
                            }
                        });
                    }
                };
                m.add(i);
            }
        }
        return m;
    }
    return super.getMenu(val);
}
Also used : Command(com.codename1.ui.Command) ActionEvent(com.codename1.ui.events.ActionEvent) MenuItem(net.rim.device.api.ui.MenuItem) Menu(net.rim.device.api.ui.component.Menu)

Aggregations

Command (com.codename1.ui.Command)1 ActionEvent (com.codename1.ui.events.ActionEvent)1 MenuItem (net.rim.device.api.ui.MenuItem)1 Menu (net.rim.device.api.ui.component.Menu)1