Created
February 14, 2016 11:28
-
-
Save codenameone/7289bbe5dad9e279eabb to your computer and use it in GitHub Desktop.
Demonstrates the usage of ScaleImageButton & ScaleImageLabel in Codename One
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TableLayout tl = new TableLayout(2, 2); | |
Form hi = new Form("ScaleImageButton/Label", tl); | |
Style s = UIManager.getInstance().getComponentStyle("Button"); | |
Image icon = FontImage.createMaterial(FontImage.MATERIAL_WARNING, s); | |
ScaleImageLabel fillLabel = new ScaleImageLabel(icon); | |
fillLabel.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL); | |
ScaleImageButton fillButton = new ScaleImageButton(icon); | |
fillButton.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL); | |
hi.add(tl.createConstraint().widthPercentage(20), new ScaleImageButton(icon)). | |
add(tl.createConstraint().widthPercentage(80), new ScaleImageLabel(icon)). | |
add(fillLabel). | |
add(fillButton); | |
hi.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of ScaleImageButton & ScaleImageLabel.
From the Codename One project