Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created February 28, 2016 10:10
Show Gist options
  • Save codenameone/da3912b9ccef03f58058 to your computer and use it in GitHub Desktop.
Save codenameone/da3912b9ccef03f58058 to your computer and use it in GitHub Desktop.
Usage of the FontImage class that allows integrating icon fonts into Codename One
Form hi = new Form("Icon Font");
Font materialFont = FontImage.getMaterialDesignFont();
int size = Display.getInstance().convertToPixels(6, true);
materialFont = materialFont.derive(size, Font.STYLE_PLAIN);
Button myButton = new Button("Save");
myButton.setIcon(FontImage.create("\uE161", myButton.getUnselectedStyle(), materialFont));
hi.add(myButton);
hi.show();
@codenameone
Copy link
Author

Sample usage of FontImage.

From the Codename One project

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