Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created February 15, 2016 13:46
Show Gist options
  • Save codenameone/5e437d82812dfcbdf092 to your computer and use it in GitHub Desktop.
Save codenameone/5e437d82812dfcbdf092 to your computer and use it in GitHub Desktop.
The varius ways in which the Picker class from Codename One can be used
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);
datePicker.setDate(new Date());
dateTimePicker.setDate(new Date());
timePicker.setTime(10 * 60); // 10:00AM = Minutes since midnight
stringPicker.setStrings("A Game of Thrones", "A Clash Of Kings", "A Storm Of Swords", "A Feast For Crows",
"A Dance With Dragons", "The Winds of Winter", "A Dream of Spring");
stringPicker.setSelectedString("A Game of Thrones");
hi.add(datePicker).add(dateTimePicker).add(timePicker).add(stringPicker);
hi.show();
@codenameone
Copy link
Author

Sample usage of Picker.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment