summaryrefslogtreecommitdiff
path: root/NET/worlds/console/OkCancelDialog.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/OkCancelDialog.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/console/OkCancelDialog.java')
-rw-r--r--NET/worlds/console/OkCancelDialog.java190
1 files changed, 190 insertions, 0 deletions
diff --git a/NET/worlds/console/OkCancelDialog.java b/NET/worlds/console/OkCancelDialog.java
new file mode 100644
index 0000000..3894f9f
--- /dev/null
+++ b/NET/worlds/console/OkCancelDialog.java
@@ -0,0 +1,190 @@
+/* */ 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 OkCancelDialog
+/* */ extends PolledDialog
+/* */ {
+/* */ private static final long serialVersionUID = -232374191442133438L;
+/* 38 */ protected Button okButton = new Button(Console.message("OK"));
+/* 39 */ protected Button cancelButton = new Button(Console.message("Cancel"));
+/* 40 */ protected GridBagLayout gbag = new GridBagLayout();
+/* */
+/* */ private String prompt;
+/* */
+/* 44 */ protected int cancelKey = 27;
+/* 45 */ protected int confirmKey = 10;
+/* */
+/* 47 */ protected static Font font = new Font(Console.message("GammaTextFont"),
+/* 48 */ 0, 12);
+/* 49 */ protected static Font bfont = new Font(Console.message("ButtonFont"),
+/* 50 */ 0, 12);
+/* */
+/* */ protected OkCancelDialog(Window parent, String title)
+/* */ {
+/* 54 */ this(parent, (DialogReceiver)parent, title);
+/* */ }
+/* */
+/* */ protected OkCancelDialog(Window parent, String title, String cancel, String ok)
+/* */ {
+/* 59 */ this(parent, (DialogReceiver)parent, title, cancel, ok);
+/* */ }
+/* */
+/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title)
+/* */ {
+/* 64 */ this(parent, target, title, true);
+/* */ }
+/* */
+/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title, boolean modal)
+/* */ {
+/* 69 */ super(parent, target, title, modal);
+/* 70 */ setLayout(this.gbag);
+/* */ }
+/* */
+/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok)
+/* */ {
+/* 75 */ this(parent, target, title, cancel, ok, true);
+/* */ }
+/* */
+/* */ protected OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, boolean modal)
+/* */ {
+/* 80 */ this(parent, target, title, modal);
+/* 81 */ if (ok != null) {
+/* 82 */ this.okButton.setFont(bfont);
+/* 83 */ this.okButton.setLabel(ok);
+/* */ } else {
+/* 85 */ this.okButton = null;
+/* */ }
+/* 87 */ if (cancel != null) {
+/* 88 */ this.cancelButton.setFont(bfont);
+/* 89 */ this.cancelButton.setLabel(cancel);
+/* */ } else {
+/* 91 */ this.cancelButton = null;
+/* */ }
+/* */ }
+/* */
+/* */ public OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt) {
+/* 96 */ this(parent, target, title, cancel, ok, prompt, true);
+/* */ }
+/* */
+/* */ public OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt, boolean modal)
+/* */ {
+/* 101 */ this(parent, target, title, cancel, ok, modal);
+/* 102 */ this.prompt = prompt;
+/* 103 */ ready();
+/* */ }
+/* */
+/* */
+/* */ public OkCancelDialog(Window parent, DialogReceiver target, String title, String cancel, String ok, String prompt, boolean modal, int alignment)
+/* */ {
+/* 109 */ this(parent, target, title, cancel, ok, modal);
+/* 110 */ this.prompt = prompt;
+/* 111 */ setAlignment(alignment);
+/* 112 */ ready();
+/* */ }
+/* */
+/* */ protected void build()
+/* */ {
+/* 117 */ GridBagConstraints c = new GridBagConstraints();
+/* 118 */ if (this.prompt != null) {
+/* 119 */ c.weightx = 1.0D;
+/* 120 */ c.weighty = 1.0D;
+/* 121 */ c.gridwidth = 0;
+/* 122 */ MultiLineLabel mll = new MultiLineLabel(this.prompt, 5, 5);
+/* 123 */ mll.setFont(font);
+/* 124 */ add(this.gbag, mll, c);
+/* */ }
+/* 126 */ int count = 0;
+/* 127 */ if (this.okButton != null)
+/* 128 */ count++;
+/* 129 */ if (this.cancelButton != null)
+/* 130 */ count++;
+/* 131 */ c.gridwidth = count;
+/* 132 */ c.weightx = 1.0D;
+/* 133 */ c.weighty = 0.0D;
+/* 134 */ if (this.okButton != null) {
+/* 135 */ this.okButton.setFont(bfont);
+/* 136 */ add(this.gbag, this.okButton, c);
+/* */ }
+/* 138 */ if (this.cancelButton != null) {
+/* 139 */ this.cancelButton.setFont(bfont);
+/* 140 */ add(this.gbag, this.cancelButton, c);
+/* */ }
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean action(Event event, Object what)
+/* */ {
+/* 147 */ Object target = event.target;
+/* 148 */ if ((target == this.okButton) && (setValue()))
+/* 149 */ return done(true);
+/* 150 */ if (target == this.cancelButton)
+/* 151 */ return done(false);
+/* 152 */ return false;
+/* */ }
+/* */
+/* */ protected boolean setValue() {
+/* 156 */ return true;
+/* */ }
+/* */
+/* */ public void setCancelKey(int key) {
+/* 160 */ this.cancelKey = key;
+/* */ }
+/* */
+/* */ public void setConfirmKey(int key) {
+/* 164 */ this.confirmKey = key;
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean keyDown(Event event, int key)
+/* */ {
+/* 170 */ if (key == this.cancelKey)
+/* 171 */ return done(false);
+/* 172 */ if (key == this.confirmKey)
+/* */ {
+/* */
+/* */
+/* 176 */ if (this.okButton != null) {
+/* 177 */ if (setValue())
+/* 178 */ return done(true);
+/* */ } else
+/* 180 */ return done(false);
+/* */ }
+/* 182 */ return super.keyDown(event, key);
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\OkCancelDialog.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file