public void startup(Display display, Dictionary<String, String> properties)
throws Exception {
bind();
loadJavaButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
form.load(CONTACT);
sourceLabel.setText("Java");
}
});
loadJSONButton.getButtonPressListeners().add(new ButtonPressListener() {
@SuppressWarnings("unchecked")
public void buttonPressed(Button button) {
JSONSerializer serializer = new JSONSerializer();
InputStream inputStream = getClass().getResourceAsStream("contact.json");
try {
form.load((Map<String, Object>)serializer.readObject(inputStream));
sourceLabel.setText("JSON");
} catch(Exception exception) {
System.out.println(exception);
}
button.setEnabled(true);
}
});
clearButton.getButtonPressListeners().add(new ButtonPressListener() {
public void buttonPressed(Button button) {
form.load(new Contact());
sourceLabel.setText(null);
}
});