diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/YesNoCancelDialog.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/console/YesNoCancelDialog.java')
| -rw-r--r-- | NET/worlds/console/YesNoCancelDialog.java | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/NET/worlds/console/YesNoCancelDialog.java b/NET/worlds/console/YesNoCancelDialog.java new file mode 100644 index 0000000..3adbf30 --- /dev/null +++ b/NET/worlds/console/YesNoCancelDialog.java @@ -0,0 +1,124 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import java.awt.Button; +/* */ import java.awt.Event; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.Window; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class YesNoCancelDialog +/* */ extends PolledDialog +/* */ { +/* */ private static final long serialVersionUID = 4497394464783317237L; +/* 26 */ private Button yesButton = new Button(Console.message("Yes")); +/* 27 */ private Button noButton = new Button(Console.message("No")); +/* 28 */ private Button cancelButton = new Button(Console.message("Cancel")); +/* 29 */ private GridBagLayout gbag = new GridBagLayout(); +/* */ private String prompt; +/* 31 */ private int choice = -2; +/* */ +/* */ public static final int UNDECIDED = -2; +/* */ public static final int CANCEL = -1; +/* */ public static final int NO = 0; +/* */ public static final int YES = 1; +/* */ +/* */ public YesNoCancelDialog(Window parent, DialogReceiver receiver, String title, String prompt) +/* */ { +/* 40 */ super(parent, receiver, title, true); +/* 41 */ this.prompt = prompt; +/* 42 */ setLayout(this.gbag); +/* 43 */ ready(); +/* */ } +/* */ +/* */ public int getChoice() { +/* 47 */ return this.choice; +/* */ } +/* */ +/* */ protected void build() +/* */ { +/* 52 */ GridBagConstraints c = new GridBagConstraints(); +/* 53 */ c.weightx = 1.0D; +/* 54 */ c.weighty = 1.0D; +/* 55 */ c.gridwidth = 0; +/* 56 */ add(this.gbag, new MultiLineLabel(this.prompt, 5, 5), c); +/* 57 */ c.gridwidth = 3; +/* 58 */ c.weightx = 1.0D; +/* 59 */ c.weighty = 0.0D; +/* 60 */ add(this.gbag, this.yesButton, c); +/* 61 */ add(this.gbag, this.noButton, c); +/* 62 */ add(this.gbag, this.cancelButton, c); +/* */ } +/* */ +/* */ +/* */ +/* */ public void setVisible(boolean visible) +/* */ { +/* 69 */ super.setVisible(visible); +/* 70 */ if (visible) { +/* 71 */ this.yesButton.requestFocus(); +/* */ } +/* */ } +/* */ +/* */ private boolean yes() { +/* 76 */ this.choice = 1; +/* 77 */ return done(true); +/* */ } +/* */ +/* */ private boolean no() { +/* 81 */ this.choice = 0; +/* 82 */ return done(false); +/* */ } +/* */ +/* */ private boolean cancel() { +/* 86 */ this.choice = -1; +/* 87 */ return done(false); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean handleEvent(Event event) +/* */ { +/* 93 */ if (event.id == 201) +/* 94 */ return cancel(); +/* 95 */ return super.handleEvent(event); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean action(Event event, Object what) +/* */ { +/* 101 */ Object target = event.target; +/* 102 */ if (target == this.yesButton) +/* 103 */ return yes(); +/* 104 */ if (target == this.noButton) +/* 105 */ return no(); +/* 106 */ if (target == this.cancelButton) +/* 107 */ return cancel(); +/* 108 */ return false; +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean keyDown(Event event, int key) +/* */ { +/* 114 */ if (key == 27) +/* 115 */ return cancel(); +/* 116 */ return super.keyDown(event, key); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\YesNoCancelDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |