Created
January 20, 2016 13:19
-
-
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
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
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); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage code for https://www.codenameone.com/javadoc/com/codename1/ui/Dialog.html and
Button
action handlingFrom the Codename One project