Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created January 20, 2016 13:19
Show Gist options
  • Save codenameone/bbf5378aec028230ce93 to your computer and use it in GitHub Desktop.
Save codenameone/bbf5378aec028230ce93 to your computer and use it in GitHub Desktop.
Sample usage of the Codename One Dialog class taken from the kitchen sink demo
final Button show = new Button("Show Dialog");
final Button showPopup = new Button("Show Popup");
cnt.add(show).add(showPopup);
show.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog.show("Dialog Title", "This is the dialog body, it can contain anything...", "OK", "Cancel");
}
});
showPopup.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog d = new Dialog("Popup Title");
TextArea popupBody = new TextArea("This is the body of the popup", 3, 10);
popupBody.setUIID("PopupBody");
popupBody.setEditable(false);
d.setLayout(new BorderLayout());
d.add(BorderLayout.CENTER, popupBody);
d.showPopupDialog(showPopup);
}
});
@codenameone
Copy link
Author

Sample usage code for https://www.codenameone.com/javadoc/com/codename1/ui/Dialog.html and Button action handling

From the Codename One project

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