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
Image duke = null; | |
try { | |
// duke.png is just the default Codename One icon copied into place | |
duke = Image.createImage("/duke.png"); | |
} catch(IOException err) { | |
Log.e(err); | |
} | |
final Image finalDuke = duke; | |
Form hi = new Form("Shape Clip"); |
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("Bubble"); | |
Button showBubble = new Button("+"); | |
showBubble.setName("BubbleButton"); | |
Style buttonStyle = showBubble.getAllStyles(); | |
buttonStyle.setBorder(Border.createEmpty()); | |
buttonStyle.setFgColor(0xffffff); | |
buttonStyle.setBgPainter((g, rect) -> { | |
g.setColor(0xff); | |
int actualWidth = rect.getWidth(); | |
int actualHeight = rect.getHeight(); |
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("Floating Hint", BoxLayout.y()); | |
TextField first = new TextField("", "First Field"); | |
TextField second = new TextField("", "Second Field"); | |
hi.add(new FloatingHint(first)). | |
add(new FloatingHint(second)). | |
add(new Button("Go")); | |
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
private Label createForFont(Font fnt, String s) { | |
Label l = new Label(s); | |
l.getUnselectedStyle().setFont(fnt); | |
return l; | |
} | |
public void showForm() { | |
GridLayout gr = new GridLayout(5); | |
gr.setAutoFit(true); | |
Form hi = new Form("Fonts", gr); |
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("Shape"); | |
// We create a 50 x 100 shape, this is arbitrary since we can scale it easily | |
GeneralPath path = new GeneralPath(); | |
path.moveTo(20,0); | |
path.lineTo(30, 0); | |
path.lineTo(30, 100); | |
path.lineTo(20, 100); | |
path.lineTo(20, 15); | |
path.lineTo(5, 40); |
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
Boolean can = Display.getInstance().canExecute("imdb:///find?q=godfather"); | |
if(can != null && can) { | |
Display.getInstance().execute("imdb:///find?q=godfather"); | |
} else { | |
Display.getInstance().execute("http://www.imdb.com"); | |
} |