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
Toolbar.setGlobalToolbar(true); | |
Form hi = new Form("Toolbar", new BoxLayout(BoxLayout.Y_AXIS)); | |
EncodedImage placeholder = EncodedImage.createFromImage(Image.createImage(hi.getWidth(), hi.getWidth() / 5, 0xffff0000), true); | |
URLImage background = URLImage.createToStorage(placeholder, "400px-AGameOfThrones.jpg", | |
"http://awoiaf.westeros.org/images/thumb/9/93/AGameOfThrones.jpg/400px-AGameOfThrones.jpg"); | |
background.fetch(); | |
Style stitle = hi.getToolbar().getTitleComponent().getUnselectedStyle(); | |
stitle.setBgImage(background); | |
stitle.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL); |
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
Toolbar.setGlobalToolbar(true); | |
Style s = UIManager.getInstance().getComponentStyle("Title"); | |
Form hi = new Form("Toolbar", new BoxLayout(BoxLayout.Y_AXIS)); | |
TextField searchField = new TextField("", "Toolbar Search"); // <1> | |
searchField.getHintLabel().setUIID("Title"); | |
searchField.setUIID("Title"); | |
searchField.getAllStyles().setAlignment(Component.LEFT); | |
hi.getToolbar().setTitleComponent(searchField); | |
FontImage searchIcon = FontImage.createMaterial(FontImage.MATERIAL_SEARCH, s); |
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("Picker", new BoxLayout(BoxLayout.Y_AXIS)); | |
Picker datePicker = new Picker(); | |
datePicker.setType(Display.PICKER_TYPE_DATE); | |
Picker dateTimePicker = new Picker(); | |
dateTimePicker.setType(Display.PICKER_TYPE_DATE_AND_TIME); | |
Picker timePicker = new Picker(); | |
timePicker.setType(Display.PICKER_TYPE_TIME); | |
Picker stringPicker = new Picker(); | |
stringPicker.setType(Display.PICKER_TYPE_STRINGS); |
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
SpanLabel d = new SpanLabel("Default SpanLabel that can seamlessly line break when the text is really long."); | |
d.setIcon(icon); | |
SpanLabel l = new SpanLabel("NORTH Positioned Icon SpanLabel that can seamlessly line break when the text is really long."); | |
l.setIcon(icon); | |
l.setIconPosition(BorderLayout.NORTH); | |
SpanLabel r = new SpanLabel("SOUTH Positioned Icon SpanLabel that can seamlessly line break when the text is really long."); | |
r.setIcon(icon); | |
r.setIconPosition(BorderLayout.SOUTH); | |
SpanLabel c = new SpanLabel("EAST Positioned Icon SpanLabel that can seamlessly line break when the text is really long."); | |
c.setIcon(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
InteractionDialog dlg = new InteractionDialog("Hello"); | |
dlg.setLayout(new BorderLayout()); | |
dlg.add(BorderLayout.CENTER, new Label("Hello Dialog")); | |
Button close = new Button("Close"); | |
close.addActionListener((ee) -> dlg.dispose()); | |
dlg.addComponent(BorderLayout.SOUTH, close); | |
Dimension pre = dlg.getContentPane().getPreferredSize(); | |
dlg.show(0, 0, Display.getInstance().getDisplayWidth() - (pre.getWidth() + pre.getWidth() / 6), 0); |
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; | |
int spanButton = 2; | |
if(Display.getInstance().isTablet()) { | |
tl = new TableLayout(7, 2); | |
} else { | |
tl = new TableLayout(14, 1); | |
spanButton = 1; | |
} | |
tl.setGrowHorizontally(true); | |
hi.setLayout(tl); |
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
hi.add("Three Labels"). | |
add(ComponentGroup.enclose(new Label("GroupElementFirst UIID"), new Label("GroupElement UIID"), new Label("GroupElementLast UIID"))). | |
add("One Label"). | |
add(ComponentGroup.enclose(new Label("GroupElementOnly UIID"))). | |
add("Three Buttons"). | |
add(ComponentGroup.enclose(new Button("ButtonGroupFirst UIID"), new Button("ButtonGroup UIID"), new Button("ButtonGroupLast UIID"))). | |
add("One Button"). | |
add(ComponentGroup.enclose(new Button("ButtonGroupOnly UIID"))); |
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
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(); |