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/UpdateableDialog.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/console/UpdateableDialog.java')
| -rw-r--r-- | NET/worlds/console/UpdateableDialog.java | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/NET/worlds/console/UpdateableDialog.java b/NET/worlds/console/UpdateableDialog.java new file mode 100644 index 0000000..f476433 --- /dev/null +++ b/NET/worlds/console/UpdateableDialog.java @@ -0,0 +1,201 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import java.awt.Button; +/* */ import java.awt.Event; +/* */ import java.awt.Font; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.Window; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class UpdateableDialog +/* */ extends PolledDialog +/* */ { +/* */ private static final long serialVersionUID = 8859312510212567551L; +/* 29 */ protected Button okButton = new Button(Console.message("OK")); +/* 30 */ protected Button cancelButton = new Button(Console.message("Cancel")); +/* 31 */ protected GridBagLayout gbag = new GridBagLayout(); +/* */ private String prompt; +/* */ private MultiLineLabel promptLabel; +/* 34 */ private static Font font = new Font(Console.message("MenuFont"), +/* 35 */ 0, 12); +/* 36 */ private static Font bfont = new Font(Console.message("ButtonFont"), +/* 37 */ 0, 12); +/* */ +/* */ +/* 40 */ protected int cancelKey = 27; +/* 41 */ protected int confirmKey = 10; +/* */ +/* */ protected UpdateableDialog(Window parent, String title) +/* */ { +/* 45 */ this(parent, (DialogReceiver)parent, title); +/* */ } +/* */ +/* */ protected UpdateableDialog(Window parent, String title, String cancel, String ok) +/* */ { +/* 50 */ this(parent, (DialogReceiver)parent, title, cancel, ok); +/* */ } +/* */ +/* */ protected UpdateableDialog(Window parent, DialogReceiver target, String title) +/* */ { +/* 55 */ this(parent, target, title, true); +/* */ } +/* */ +/* */ protected UpdateableDialog(Window parent, DialogReceiver target, String title, boolean modal) +/* */ { +/* 60 */ super(parent, target, title, modal); +/* 61 */ setLayout(this.gbag); +/* */ } +/* */ +/* */ protected UpdateableDialog(Window parent, DialogReceiver target, String title, String cancel, String ok) +/* */ { +/* 66 */ this(parent, target, title, cancel, ok, true); +/* */ } +/* */ +/* */ protected UpdateableDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, boolean modal) +/* */ { +/* 71 */ this(parent, target, title, modal); +/* 72 */ if (ok != null) { +/* 73 */ this.okButton.setLabel(ok); +/* */ } else { +/* 75 */ this.okButton = null; +/* */ } +/* 77 */ if (cancel != null) { +/* 78 */ this.cancelButton.setLabel(cancel); +/* */ } else { +/* 80 */ this.cancelButton = null; +/* */ } +/* */ } +/* */ +/* */ public UpdateableDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt) { +/* 85 */ this(parent, target, title, cancel, ok, prompt, true); +/* */ } +/* */ +/* */ public UpdateableDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt, boolean modal) +/* */ { +/* 90 */ this(parent, target, title, cancel, ok, modal); +/* 91 */ setFont(font); +/* 92 */ this.prompt = prompt; +/* 93 */ ready(); +/* */ } +/* */ +/* */ +/* */ public UpdateableDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt, boolean modal, int alignment) +/* */ { +/* 99 */ this(parent, target, title, cancel, ok, modal); +/* 100 */ this.prompt = prompt; +/* 101 */ setAlignment(alignment); +/* 102 */ ready(); +/* */ } +/* */ +/* */ protected void build() +/* */ { +/* 107 */ GridBagConstraints c = new GridBagConstraints(); +/* 108 */ if (this.prompt != null) { +/* 109 */ c.weightx = 1.0D; +/* 110 */ c.weighty = 1.0D; +/* 111 */ c.gridwidth = 0; +/* 112 */ this.promptLabel = new MultiLineLabel(this.prompt, 5, 5); +/* 113 */ this.promptLabel.setFont(font); +/* 114 */ add(this.gbag, this.promptLabel, c); +/* */ } +/* 116 */ int count = 0; +/* 117 */ if (this.okButton != null) +/* 118 */ count++; +/* 119 */ if (this.cancelButton != null) +/* 120 */ count++; +/* 121 */ c.gridwidth = count; +/* 122 */ c.weightx = 1.0D; +/* 123 */ c.weighty = 0.0D; +/* 124 */ if (this.okButton != null) { +/* 125 */ this.okButton.setFont(bfont); +/* 126 */ add(this.gbag, this.okButton, c); +/* */ } +/* 128 */ if (this.cancelButton != null) { +/* 129 */ this.cancelButton.setFont(bfont); +/* 130 */ add(this.gbag, this.cancelButton, c); +/* */ } +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean action(Event event, Object what) +/* */ { +/* 137 */ Object target = event.target; +/* 138 */ if ((target == this.okButton) && (setValue())) +/* 139 */ return done(true); +/* 140 */ if (target == this.cancelButton) +/* 141 */ return done(false); +/* 142 */ return false; +/* */ } +/* */ +/* */ protected boolean setValue() { +/* 146 */ return true; +/* */ } +/* */ +/* */ public void setCancelKey(int key) { +/* 150 */ this.cancelKey = key; +/* */ } +/* */ +/* */ public void setConfirmKey(int key) { +/* 154 */ this.confirmKey = key; +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean keyDown(Event event, int key) +/* */ { +/* 160 */ if (key == this.cancelKey) +/* 161 */ return done(false); +/* 162 */ if (key == this.confirmKey) +/* */ { +/* */ +/* */ +/* 166 */ if (this.okButton != null) { +/* 167 */ if (setValue()) +/* 168 */ return done(true); +/* */ } else +/* 170 */ return done(false); +/* */ } +/* 172 */ return super.keyDown(event, key); +/* */ } +/* */ +/* */ public void setPrompt(String text) { +/* 176 */ GridBagConstraints c = new GridBagConstraints(); +/* 177 */ this.prompt = text; +/* 178 */ if (this.promptLabel != null) { +/* 179 */ this.gbag.removeLayoutComponent(this.promptLabel); +/* */ } +/* */ +/* 182 */ c.weightx = 1.0D; +/* 183 */ c.weighty = 1.0D; +/* 184 */ c.gridwidth = 0; +/* 185 */ this.promptLabel = new MultiLineLabel(this.prompt, 5, 5); +/* 186 */ add(this.gbag, this.promptLabel, c); +/* */ +/* 188 */ setVisible(true); +/* */ } +/* */ +/* */ public void closeIt(boolean state) +/* */ { +/* 193 */ done(state); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\UpdateableDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |