/* */ package NET.worlds.console; /* */ /* */ import NET.worlds.core.IniFile; /* */ import NET.worlds.scape.Pilot; /* */ import java.awt.BorderLayout; /* */ import java.awt.Color; /* */ import java.awt.Event; /* */ import java.awt.Panel; /* */ import java.awt.TextField; /* */ import java.awt.Window; /* */ import java.io.PrintStream; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class WhisperDialog /* */ extends PolledDialog /* */ { /* */ private static final long serialVersionUID = -5767168735798633258L; /* */ protected static Window parent; /* */ protected boolean building; /* */ /* */ static void setParent(Window p) /* */ { /* 74 */ parent = p; /* */ } /* */ /* */ static void sendTalkMessage(String msg) { /* 78 */ Main.register(new MainCallback() { /* */ public void mainCallback() { /* 80 */ System.out.println("Sending a Text Message: " + WhisperDialog.this); /* 81 */ Pilot.sendText(WhisperDialog.this); /* 82 */ Main.unregister(this); /* */ } /* */ }); /* */ } /* */ /* 87 */ protected boolean isTrading = false; /* */ protected WhisperPart whisperPart; /* */ protected String partner; /* */ protected boolean isBroadcast; /* */ protected boolean built; /* 92 */ protected static int counter = 0; /* */ protected static final int OFFSET = 20; /* */ protected static final int OFF_TOT = 6; /* */ /* */ protected WhisperDialog(Window parent, String partner) /* */ { /* 98 */ super(parent, null, Console.message("Whisper-to-from2") + Console.parseExtended(partner), false); /* */ /* 100 */ this.partner = partner; /* 101 */ this.isBroadcast = true; /* 102 */ if (partner.equals("room")) { /* 103 */ setTitle(Console.message("Broadcast-Users")); /* 104 */ } else if (partner.equals("world")) { /* 105 */ setTitle(Console.message("Broadcast-All")); /* */ } else /* 107 */ this.isBroadcast = false; /* 108 */ this.whisperPart = new WhisperPart(partner); /* 109 */ Console active = Console.getActive(); /* 110 */ if (active != null) { /* 111 */ active.addPart(this.whisperPart); /* */ } /* */ /* */ /* */ /* 116 */ int tier = counter / 6; /* 117 */ int pos = counter % 6; /* 118 */ setAlignment(1, ((pos + tier) % 12 - 5) * /* 119 */ 20, (pos % 6 - 5) * 20); /* 120 */ counter += 1; /* */ } /* */ /* */ protected void takeFocus() { /* 124 */ this.whisperPart.forceTakeFocus(); /* */ } /* */ /* */ /* */ /* */ /* */ public void setVisible(boolean visible) /* */ { /* 132 */ super.setVisible(visible); /* */ /* 134 */ if (visible) /* */ { /* */ /* */ /* */ /* 139 */ this.whisperPart.scrollToBottom(); /* */ /* */ /* */ /* 143 */ int toFront = IniFile.override().getIniInt("whispersToFront", 0); /* 144 */ if (toFront != 0) { /* 145 */ toFront(); /* */ } /* */ } /* */ } /* */ /* */ protected void send(String msg) { /* 151 */ this.whisperPart.println("< " + msg); /* */ } /* */ /* */ protected synchronized void print(String msg) { /* 155 */ this.whisperPart.println("> " + msg); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected synchronized void build() /* */ { /* 166 */ this.building = false; /* */ /* 168 */ if (this.built) { /* 169 */ removeAll(); /* */ } /* 171 */ this.built = true; /* */ /* */ /* */ /* 175 */ Color bg1 = new Color(0, 0, 0); /* 176 */ Color bg2 = new Color(0, 192, 192); /* */ /* 178 */ Color fg1 = new Color(255, 255, 255); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 189 */ setBackground(fg1); /* 190 */ setForeground(bg1); /* */ /* */ /* */ /* 194 */ this.whisperPart.line.setBackground(this.isTrading ? bg2 : fg1); /* 195 */ this.whisperPart.listen.setBackground(fg1); /* */ /* 197 */ Panel insListen = new InsetPanel(new BorderLayout(), 3, 1, 1, 1); /* 198 */ insListen.setBackground(Color.lightGray); /* 199 */ insListen.add("Center", this.whisperPart.listen.getComponent()); /* 200 */ add("Center", insListen); /* 201 */ Panel insLine = new InsetPanel(new BorderLayout(), 2, 1, 2, 1); /* 202 */ insLine.setBackground(Color.lightGray); /* 203 */ insLine.add("Center", this.whisperPart.line); /* 204 */ add("South", insLine); /* */ /* 206 */ validate(); /* */ } /* */ /* */ protected boolean setValue() { /* 210 */ return true; /* */ } /* */ /* */ @Deprecated /* */ public synchronized boolean keyDown(Event event, int key) /* */ { /* 216 */ this.whisperPart.line.requestFocus(); /* */ /* 218 */ if (key == 10) { /* 219 */ this.whisperPart.trigger(); /* 220 */ return true; /* */ } /* 222 */ return false; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\WhisperDialog.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */