From e1e781bb2135ef78592226f1a3eaba4925702f1f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 3 May 2021 16:38:41 -0700 Subject: :star: --- NET/worlds/console/ChatDialog.java | 204 +++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 NET/worlds/console/ChatDialog.java (limited to 'NET/worlds/console/ChatDialog.java') diff --git a/NET/worlds/console/ChatDialog.java b/NET/worlds/console/ChatDialog.java new file mode 100644 index 0000000..cf75c95 --- /dev/null +++ b/NET/worlds/console/ChatDialog.java @@ -0,0 +1,204 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import java.awt.Button; +/* */ import java.awt.Choice; +/* */ import java.awt.Event; +/* */ import java.awt.Font; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.Label; +/* */ import java.awt.Panel; +/* */ import java.awt.TextField; +/* */ import java.awt.Window; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class ChatDialog +/* */ extends PolledDialog +/* */ { +/* */ private static final long serialVersionUID = 2346715931784644393L; +/* 35 */ private Label fontsizeLabel = new Label(Console.message("Font-Size")); +/* 36 */ private Label linesLabel = new Label(Console.message("Chat-Lines")); +/* 37 */ private Label chatlengthLabel = new Label(Console.message("Chat-Buffer-Length")); +/* 38 */ private Button okButton = new Button(Console.message("OK")); +/* 39 */ private Button cancelButton = new Button(Console.message("Cancel")); +/* 40 */ private static Font font = new Font(Console.message("MenuFont"), 0, 12); +/* */ +/* */ +/* */ +/* */ private Choice fontsizeChoice; +/* */ +/* */ +/* */ +/* */ private Choice linesChoice; +/* */ +/* */ +/* */ private TextField chatlengthField; +/* */ +/* */ +/* */ +/* */ public ChatDialog(Window parent, DialogReceiver receiver, String title, int defSize, int defLines, int defLength) +/* */ { +/* 57 */ super(parent, receiver, title, true); +/* */ +/* */ +/* */ +/* 61 */ this.fontsizeChoice = new Choice(); +/* 62 */ this.linesChoice = new Choice(); +/* 63 */ this.chatlengthField = new TextField(defLength); +/* */ +/* 65 */ for (int i = 0; i <= 16; i++) +/* */ { +/* 67 */ this.fontsizeChoice.insert(i + 10 + "pt", i); +/* */ } +/* 69 */ if ((defSize < 10) || (defSize > 16)) { +/* 70 */ this.fontsizeChoice.select(2); +/* */ } else { +/* 72 */ this.fontsizeChoice.select(defSize - 10); +/* */ } +/* */ +/* 75 */ for (int i = 0; i < 24; i++) +/* */ { +/* 77 */ this.linesChoice.insert(i + 6 + " lines", i); +/* */ } +/* 79 */ if ((defLines < 6) || (defLines > 30)) { +/* 80 */ this.linesChoice.select(0); +/* */ } else { +/* 82 */ this.linesChoice.select(defLines - 6); +/* */ } +/* */ +/* 85 */ ready(); +/* */ } +/* */ +/* */ public int getFontsize() +/* */ { +/* */ try +/* */ { +/* 92 */ return this.fontsizeChoice.getSelectedIndex() + 10; +/* */ } catch (Exception e) {} +/* 94 */ return 12; +/* */ } +/* */ +/* */ +/* */ public int getLines() +/* */ { +/* */ try +/* */ { +/* 102 */ return this.linesChoice.getSelectedIndex() + 6; +/* */ } catch (Exception e) {} +/* 104 */ return 6; +/* */ } +/* */ +/* */ public int getLength() +/* */ { +/* */ try { +/* 110 */ return Integer.parseInt(this.chatlengthField.getText()); +/* */ } catch (Exception e) {} +/* 112 */ return 20000; +/* */ } +/* */ +/* */ +/* */ +/* */ protected void build() +/* */ { +/* 119 */ GridBagLayout gbag = new GridBagLayout(); +/* 120 */ setLayout(gbag); +/* 121 */ GridBagConstraints c = new GridBagConstraints(); +/* 122 */ c.weightx = 1.0D; +/* 123 */ c.weighty = 1.0D; +/* 124 */ c.gridheight = 1; +/* 125 */ c.fill = 0; +/* */ +/* 127 */ c.gridwidth = 2; +/* 128 */ this.fontsizeLabel.setFont(font); +/* 129 */ add(gbag, this.fontsizeLabel, c); +/* 130 */ c.gridwidth = 0; +/* 131 */ c.fill = 2; +/* */ +/* 133 */ add(gbag, this.fontsizeChoice, c); +/* */ +/* 135 */ c.fill = 0; +/* 136 */ c.gridwidth = 2; +/* 137 */ this.linesLabel.setFont(font); +/* 138 */ add(gbag, this.linesLabel, c); +/* 139 */ c.gridwidth = 0; +/* 140 */ c.fill = 2; +/* */ +/* 142 */ add(gbag, this.linesChoice, c); +/* */ +/* 144 */ c.gridwidth = 2; +/* 145 */ this.chatlengthLabel.setFont(font); +/* 146 */ add(gbag, this.chatlengthLabel, c); +/* 147 */ c.gridwidth = 0; +/* 148 */ c.fill = 2; +/* 149 */ this.chatlengthField.setFont(font); +/* 150 */ add(gbag, this.chatlengthField, c); +/* */ +/* 152 */ Panel buttons = new Panel(); +/* 153 */ buttons.add(this.okButton); +/* 154 */ buttons.add(this.cancelButton); +/* 155 */ this.okButton.setFont(font); +/* 156 */ this.cancelButton.setFont(font); +/* 157 */ c.gridwidth = 0; +/* 158 */ c.fill = 0; +/* 159 */ add(gbag, buttons, c); +/* */ } +/* */ +/* */ +/* */ public void setVisible(boolean visible) +/* */ { +/* 165 */ if (visible) { +/* 166 */ initialSize(320, 160); +/* 167 */ super.setVisible(visible); +/* */ +/* 169 */ this.fontsizeChoice.requestFocus(); +/* */ } else { +/* 171 */ super.setVisible(visible); +/* */ } +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean handleEvent(Event event) { +/* 177 */ if (event.id == 201) +/* 178 */ return done(false); +/* 179 */ return super.handleEvent(event); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean action(Event event, Object what) { +/* 184 */ Object target = event.target; +/* 185 */ if (target == this.cancelButton) { +/* 186 */ done(false); +/* 187 */ } else if (target == this.okButton) +/* 188 */ done(true); +/* 189 */ return false; +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean keyDown(Event event, int key) { +/* 194 */ if (key == 27) +/* 195 */ return done(false); +/* 196 */ return super.keyDown(event, key); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\ChatDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */ \ No newline at end of file -- cgit v1.2.3