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
public void showForm() { | |
Form hi = new Form("ComboBox", new BoxLayout(BoxLayout.Y_AXIS)); | |
ComboBox<Map<String, Object>> combo = new ComboBox<> ( | |
createListEntry("A Game of Thrones", "1996"), | |
createListEntry("A Clash Of Kings", "1998"), | |
createListEntry("A Storm Of Swords", "2000"), | |
createListEntry("A Feast For Crows", "2005"), | |
createListEntry("A Dance With Dragons", "2011"), | |
createListEntry("The Winds of Winter", "2016 (please, please, please)"), | |
createListEntry("A Dream of Spring", "Ugh")); |
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
Form hi = new Form("Calendar", new BorderLayout()); | |
Calendar cld = new Calendar(); | |
cld.addActionListener((e) -> Log.p("You picked: " + new Date(cld.getSelectedDay()))); | |
hi.add(BorderLayout.CENTER, cld); |
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
Form hi = new Form("Browser", new BorderLayout()); | |
BrowserComponent browser = new BrowserComponent(); | |
browser.setURL("https://www.codenameone.com/"); | |
hi.add(BorderLayout.CENTER, browser); |
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
Form hi = new Form("Auto Complete", new BoxLayout(BoxLayout.Y_AXIS)); | |
AutoCompleteTextField ac = new AutoCompleteTextField("Short", "Shock", "Sholder", "Shrek"); | |
ac.setMinimumElementsShownInPopup(5); | |
hi.add(ac); |
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)). |
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
Form hi = new Form("ImageViewer", new BorderLayout()); | |
final EncodedImage placeholder = EncodedImage.createFromImage( | |
FontImage.createMaterial(FontImage.MATERIAL_SYNC, s). | |
scaled(300, 300), false); | |
class ImageList implements ListModel<Image> { | |
private int selection; | |
private String[] imageURLs = { | |
"http://awoiaf.westeros.org/images/thumb/9/93/AGameOfThrones.jpg/300px-AGameOfThrones.jpg", | |
"http://awoiaf.westeros.org/images/thumb/3/39/AClashOfKings.jpg/300px-AClashOfKings.jpg", |
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
Form hi = new Form("ImageViewer", new BorderLayout()); | |
Image red = Image.createImage(100, 100, 0xffff0000); | |
Image green = Image.createImage(100, 100, 0xff00ff00); | |
Image blue = Image.createImage(100, 100, 0xff0000ff); | |
Image gray = Image.createImage(100, 100, 0xffcccccc); | |
ImageViewer iv = new ImageViewer(red); | |
iv.setImageList(new DefaultListModel<>(red, green, blue, gray)); | |
hi.add(BorderLayout.CENTER, iv); |
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
Form hi = new Form("ImageViewer", new BorderLayout()); | |
ImageViewer iv = new ImageViewer(duke); | |
hi.add(BorderLayout.CENTER, iv); |