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("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(); |
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("Icon Font"); | |
Font materialFont = FontImage.getMaterialDesignFont(); | |
int w = Display.getInstance().getDisplayWidth(); | |
FontImage fntImage = FontImage.createFixed("\uE161", materialFont, 0xff0000, w, w); | |
hi.add(fntImage); | |
hi.show(); |
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("Glass Pane", new BoxLayout(BoxLayout.Y_AXIS)); | |
Style s = UIManager.getInstance().getComponentStyle("Label"); | |
s.setFgColor(0xff0000); | |
s.setBgTransparency(0); | |
Image warningImage = FontImage.createMaterial(FontImage.MATERIAL_WARNING, s).toImage(); | |
TextField tf1 = new TextField("My Field"); | |
tf1.getAllStyles().setMarginUnit(Style.UNIT_TYPE_DIPS); | |
tf1.getAllStyles().setMargin(5, 5, 5, 5); | |
hi.add(tf1); | |
hi.setGlassPane((g, rect) -> { |
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("Transitions", new BoxLayout(BoxLayout.Y_AXIS)); | |
Style bg = hi.getContentPane().getUnselectedStyle(); | |
bg.setBgTransparency(255); | |
bg.setBgColor(0xff0000); | |
Button showTransition = new Button("Show"); | |
Picker pick = new Picker(); | |
pick.setStrings("Slide", "SlideFade", "Cover", "Uncover", "Fade", "Flip"); | |
pick.setSelectedString("Slide"); | |
TextField duration = new TextField("10000", "Duration", 6, TextArea.NUMERIC); |
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 pictureUpload(final Callback<String> resultURL) { | |
String picture = Capture.capturePhoto(1024, -1); | |
if(picture!=null){ | |
String filestack = "https://www.filestackapi.com/api/store/S3?key=MY_KEY&filename=myPicture.jpg"; | |
MultipartRequest request = new MultipartRequest() { | |
protected void readResponse(InputStream input) throws IOException { | |
JSONParser jp = new JSONParser(); | |
Map<String, Object> result = jp.parseJSON(new InputStreamReader(input, "UTF-8")); | |
String url = (String)result.get("url"); | |
if(url == null) { |
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
/** | |
* Creates a renderer for the specified colors. | |
*/ | |
private DefaultRenderer buildCategoryRenderer(int[] colors) { | |
DefaultRenderer renderer = new DefaultRenderer(); | |
renderer.setLabelsTextSize(15); | |
renderer.setLegendTextSize(15); | |
renderer.setMargins(new int[]{20, 30, 15, 0}); | |
for (int color : colors) { | |
SimpleSeriesRenderer r = new SimpleSeriesRenderer(); |
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("Swipe", new BoxLayout(BoxLayout.Y_AXIS)); | |
hi.add(createRankWidget("A Game of Thrones", "1996")). | |
add(createRankWidget("A Clash Of Kings", "1998")). | |
add(createRankWidget("A Storm Of Swords", "2000")). | |
add(createRankWidget("A Feast For Crows", "2005")). | |
add(createRankWidget("A Dance With Dragons", "2011")). | |
add(createRankWidget("The Winds of Winter", "TBD")). | |
add(createRankWidget("A Dream of Spring", "TBD")); | |
hi.show(); |
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("Star Slider", new BoxLayout(BoxLayout.Y_AXIS)); | |
hi.add(FlowLayout.encloseCenter(createStarRankSlider())); | |
hi.show(); | |
} | |
private void initStarRankStyle(Style s, Image star) { | |
s.setBackgroundType(Style.BACKGROUND_IMAGE_TILE_BOTH); | |
s.setBorder(Border.createEmpty()); | |
s.setBgImage(star); |
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("ToastBarDemo", BoxLayout.y()); | |
Button basic = new Button("Basic"); | |
Button progress = new Button("Progress"); | |
Button expires = new Button("Expires"); | |
Button delayed = new Button("Delayed"); | |
hi.add(basic).add(progress).add(expires).add(delayed); | |
basic.addActionListener(e -> { | |
ToastBar.Status status = ToastBar.getInstance().createStatus(); |
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
Map<String, Object> proto = new HashMap<>(); | |
map.put("Line1", "WWWWWWWWWWWWWWWWWWWW"); | |
map.put("Line2", "WWWWWWWWWWWWWWWWWWWW"); | |
int mm5 = Display.getInstance().convertToPixels(5, true); | |
map.put("icon", Image.create(mm5, mm5)); | |
myMultiList.setRenderingPrototype(map); |