Created
November 5, 2017 13:00
-
-
Save codenameone/5a28c7944aeab7d8ae6b26dc81690238 to your computer and use it in GitHub Desktop.
This file contains 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
TextModeLayout tl = new TextModeLayout(3, 2); | |
Form f = new Form("Pixel Perfect", tl); | |
TextComponent title = new TextComponent().label("Title"); | |
TextComponent price = new TextComponent().label("Price"); | |
TextComponent location = new TextComponent().label("Location"); | |
PickerComponent date = PickerComponent.createDate(new Date()).label("Date"); | |
TextComponent description = new TextComponent().label("Description").multiline(true); | |
Validator val = new Validator(); | |
val.addConstraint(title, new LengthConstraint(2)); | |
val.addConstraint(price, new NumericConstraint(true)); | |
f.add(tl.createConstraint().widthPercentage(60), title); | |
f.add(tl.createConstraint().widthPercentage(40), date); | |
f.add(location); | |
f.add(price); | |
f.add(tl.createConstraint().horizontalSpan(2), description); | |
f.setEditOnShow(title.getField()); | |
f.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment