Skip to content

Instantly share code, notes, and snippets.

@codenameone
Last active July 8, 2020 09:57
Show Gist options
  • Save codenameone/e72cfa6aedd7fcd1af72 to your computer and use it in GitHub Desktop.
Save codenameone/e72cfa6aedd7fcd1af72 to your computer and use it in GitHub Desktop.
Sample basic usage of the Toolbar API
Toolbar.setGlobalToolbar(true);
Form hi = new Form("Toolbar", new BoxLayout(BoxLayout.Y_AXIS));
Style s = UIManager.getInstance().getComponentStyle("TitleCommand");
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_WARNING, s);
hi.getToolbar().addCommandToLeftBar("Left", icon, (e) -> Log.p("Clicked"));
hi.getToolbar().addCommandToRightBar("Right", icon, (e) -> Log.p("Clicked"));
hi.getToolbar().addCommandToOverflowMenu("Overflow", icon, (e) -> Log.p("Clicked"));
hi.getToolbar().addCommandToSideMenu("Sidemenu", icon, (e) -> Log.p("Clicked"));
hi.show();
@codenameone
Copy link
Author

Sample usage of Toolbar.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment