Hi
I am trying to make use of a traditional menu that appears at the bottom of
the form (not lateral or contextual).
The error that appears to me is:
*java.lang.ClassCastException: com.mycia.menubar.MenuBar cannot be cast to
com.codename1.ui.MenuBar*
I appreciate if you provide me with an example to continue moving forward
in my project.
My code:
public class MenuBar {
private Form current;
public void init(Object context) {
try {
// use two network threads instead of one
updateNetworkThreadCount(2);
Resources theme = Resources.openLayered("/theme");
UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
UIManager.getInstance().getLookAndFeel().setMenuBarClass(MenuBar.class);
} catch (IOException ex) {
}
}
public void start() {
if (current != null) {
current.show();
return;
}
Image imSelect = null;
Image imCancel = null;
Image imMenu = null;
try {
imSelect = Image.createImage("/m_brasilia.png");
imCancel = Image.createImage("/m_brasilia.png");
imMenu = Image.createImage("/m_brasilia.png");
} catch (IOException ex) {
}
//
Form menuBar = new Form("Menu Prueba");
menuBar.addCommand(new Command("Command 1", imSelect));
menuBar.addCommand(new Command("Command 2", imCancel));
menuBar.addCommand(new Command("Command 3", imMenu));
menuBar.addCommandListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog.show("WARNING !", ((Command)
evt.getSource()).getCommandName() + " pressed !", "OK", null);
}
});
menuBar.show();
}
public void stop() {
current = getCurrentForm();
}
public void destroy() {
}
}
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/df77fbfd-05e5-4342-887b-9b457be9e0fd%40googlegroups.com.