forked from pquiring/javaforce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessagePopup.java
More file actions
executable file
·40 lines (38 loc) · 877 Bytes
/
Copy pathMessagePopup.java
File metadata and controls
executable file
·40 lines (38 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package javaforce.webui;
/** Message Popup
*
* Shows a popup message with OK / Cancel buttons.
*
* Use addActionListener() to respond to OK button.
*
* @author pquiring
*/
public class MessagePopup extends PopupPanel {
public MessagePopup(String title, String msg, boolean showCancel) {
super(title);
lbl = new Label(msg);
add(lbl);
Row row = new Row();
add(row);
ok = new Button("OK");
row.add(ok);
if (showCancel) {
cancel = new Button("Cancel");
row.add(cancel);
}
ok.addClickListener((e, c) -> {
setVisible(false);
action();
});
if (showCancel) {
cancel.addClickListener((e, c) -> {
setVisible(false);
});
}
}
private Label lbl;
private Button ok, cancel;
public void setText(String msg) {
lbl.setText(msg);
}
}