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/TradeDialog.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/console/TradeDialog.java')
| -rw-r--r-- | NET/worlds/console/TradeDialog.java | 759 |
1 files changed, 759 insertions, 0 deletions
diff --git a/NET/worlds/console/TradeDialog.java b/NET/worlds/console/TradeDialog.java new file mode 100644 index 0000000..7de4814 --- /dev/null +++ b/NET/worlds/console/TradeDialog.java @@ -0,0 +1,759 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import NET.worlds.scape.InventoryItem; +/* */ import NET.worlds.scape.InventoryManager; +/* */ import NET.worlds.scape.Pilot; +/* */ import java.awt.BorderLayout; +/* */ import java.awt.Checkbox; +/* */ import java.awt.Color; +/* */ import java.awt.Container; +/* */ import java.awt.Dimension; +/* */ import java.awt.Event; +/* */ import java.awt.Font; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.GridLayout; +/* */ import java.awt.Insets; +/* */ import java.awt.Label; +/* */ import java.awt.Panel; +/* */ import java.awt.ScrollPane; +/* */ import java.awt.TextField; +/* */ import java.awt.Window; +/* */ import java.text.MessageFormat; +/* */ import java.util.Enumeration; +/* */ import java.util.Hashtable; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class TradeDialog +/* */ extends WhisperDialog +/* */ { +/* */ private static final long serialVersionUID = -6745488915622839369L; +/* */ public static final String tradeServerName = "TRADE"; +/* 89 */ private Checkbox confirmBox = new Checkbox(Console.message("Its-a-Deal")); +/* */ +/* */ ScrollPane scrollPane; +/* 92 */ private static Font font = new Font(Console.message("DialogFont"), +/* 93 */ 0, 12); +/* */ +/* */ +/* 96 */ private String lastOfferSent = ""; +/* */ +/* */ +/* 99 */ private String lastOfferReceived = ""; +/* */ +/* */ +/* */ private Vector<TextField> fieldList; +/* */ +/* */ private int keyChange; +/* */ +/* */ +/* */ public TradeDialog(Window parent, String partner) +/* */ { +/* 109 */ super(parent, partner); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static void sendTradeMessage(String msg) +/* */ { +/* 117 */ Main.register(new MainCallback() { +/* */ public void mainCallback() { +/* 119 */ Pilot.sendText("TRADE", TradeDialog.this); +/* 120 */ Main.unregister(this); +/* */ } +/* */ }); +/* */ } +/* */ +/* */ public synchronized void setTrading(boolean f) { +/* 126 */ this.lastOfferReceived = ""; +/* 127 */ this.lastOfferSent = ""; +/* */ +/* 129 */ this.isTrading = f; +/* 130 */ if (this.isTrading) { +/* 131 */ Object[] arguments = { new String(this.partner) }; +/* 132 */ Console.println(MessageFormat.format(Console.message("Trade-with"), +/* 133 */ arguments)); +/* */ +/* */ +/* */ } +/* */ else +/* */ { +/* */ +/* 140 */ Object[] arguments = { new String(this.partner) }; +/* 141 */ Console.println(MessageFormat.format( +/* 142 */ Console.message("Whisper-to-from"), arguments)); +/* */ } +/* */ +/* 145 */ if ((this.built) && (!this.building)) { +/* 146 */ this.building = true; +/* 147 */ Main.register(new MainCallback() { +/* */ public void mainCallback() { +/* 149 */ TradeDialog.this.build(); +/* 150 */ TradeDialog.this.pack(); +/* 151 */ Main.unregister(this); +/* */ } +/* */ }); +/* */ } +/* */ } +/* */ +/* 157 */ protected Panel hisOffer = new Panel(); +/* 158 */ protected Panel yourOffer = new Panel(); +/* */ +/* */ public boolean action(Event event, Object what) +/* */ { +/* 162 */ Object target = event.target; +/* 163 */ if ((target == this.confirmBox) && (this.confirmBox.getState())) { +/* 164 */ sendOffer(true, false); +/* 165 */ return true; +/* */ } +/* */ +/* 168 */ return false; +/* */ } +/* */ +/* */ +/* */ protected synchronized void activeCallback() +/* */ { +/* 174 */ if ((this.keyChange > 0) && +/* 175 */ (--this.keyChange == 0)) { +/* 176 */ sendOffer(false, true); +/* */ } +/* */ } +/* */ +/* */ private void displayOffer(String offerStr, Panel p) +/* */ { +/* 182 */ InventoryManager im = InventoryManager.getInventoryManager(); +/* 183 */ Hashtable<String, InventoryItem> shorts = im.parseInventoryString(offerStr); +/* */ +/* 185 */ p.removeAll(); +/* */ +/* 187 */ GridBagConstraints c = new GridBagConstraints(); +/* 188 */ GridBagLayout gbag = new GridBagLayout(); +/* 189 */ p.setLayout(gbag); +/* */ +/* 191 */ c.weightx = 1.0D; +/* 192 */ c.weighty = 0.0D; +/* 193 */ c.gridheight = 1; +/* 194 */ c.gridwidth = 0; +/* 195 */ c.insets = new Insets(6, 3, 0, 8); +/* */ +/* 197 */ c.anchor = 17; +/* */ +/* 199 */ if (shorts.size() == 0) { +/* 200 */ c.gridwidth = -1; +/* 201 */ c.insets = new Insets(36, 20, 36, 3); +/* 202 */ Label lab = new Label(Console.message("Nothing")); +/* 203 */ gbag.setConstraints(lab, c); +/* 204 */ p.add(lab); +/* */ } +/* */ +/* 207 */ if (shorts.size() > 0) { +/* 208 */ Enumeration<InventoryItem> shortEnum = shorts.elements(); +/* */ +/* */ +/* 211 */ while (shortEnum.hasMoreElements()) { +/* 212 */ InventoryItem invItem = (InventoryItem)shortEnum.nextElement(); +/* 213 */ c.gridwidth = -1; +/* 214 */ c.insets = new Insets(6, 3, 0, 8); +/* */ +/* 216 */ ImageCanvas imcv = new ImageCanvas( +/* 217 */ invItem.getItemGraphicLocation()); +/* 218 */ gbag.setConstraints(imcv, c); +/* 219 */ p.add(imcv); +/* */ +/* 221 */ c.gridwidth = 0; +/* 222 */ c.insets = new Insets(3, 3, 0, 3); +/* */ +/* 224 */ Label lab = new Label(InventoryManager.getInventoryManager() +/* 225 */ .itemName(invItem)); +/* 226 */ gbag.setConstraints(lab, c); +/* 227 */ p.add(lab); +/* */ } +/* */ } +/* 230 */ p.invalidate(); +/* 231 */ p.doLayout(); +/* 232 */ p.validate(); +/* 233 */ p.repaint(); +/* */ +/* 235 */ Container par = p.getParent(); +/* 236 */ if (par != null) { +/* 237 */ par.invalidate(); +/* 238 */ par.doLayout(); +/* 239 */ par.validate(); +/* 240 */ par.repaint(); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ private synchronized void sendOffer(boolean isDeal, boolean onlyIfChanged) +/* */ { +/* 258 */ String offer = ""; +/* 259 */ InventoryManager im = InventoryManager.getInventoryManager(); +/* 260 */ Hashtable<String, InventoryItem> invHash = im.getInventoryItems(); +/* 261 */ if (invHash.size() > 0) { +/* 262 */ Enumeration<InventoryItem> invEnum = invHash.elements(); +/* */ +/* 264 */ int i = 0; +/* */ +/* 266 */ while (invEnum.hasMoreElements()) { +/* 267 */ InventoryItem invItem = (InventoryItem)invEnum.nextElement(); +/* 268 */ TextField tf = (TextField)this.fieldList.elementAt(i); +/* 269 */ tf.setFont(font); +/* 270 */ String nm = invItem.getItemId(); +/* 271 */ int count = -1; +/* 272 */ if (tf.getText().trim().length() == 0) { +/* 273 */ count = 0; +/* */ } else { +/* */ try { +/* 276 */ count = Integer.parseInt(tf.getText()); +/* */ } +/* */ catch (NumberFormatException localNumberFormatException) {} +/* */ } +/* */ +/* */ +/* 282 */ int maxCount = invItem.getItemQuantity(); +/* 283 */ if ((count < 0) || (count > maxCount)) { +/* 284 */ this.whisperPart.println("*** Invalid number of " + +/* 285 */ InventoryManager.getInventoryManager().getPlural( +/* 286 */ nm) + ": " + tf.getText() + "."); +/* 287 */ return; +/* */ } +/* */ +/* 290 */ if (count > 0) { +/* 291 */ offer = offer + nm; +/* 292 */ if (count > 1) +/* 293 */ offer = offer + Integer.toString(count); +/* */ } +/* 295 */ i++; +/* */ } +/* */ } +/* */ +/* */ +/* 300 */ String ourPartOfOffer = offer; +/* */ +/* */ +/* 303 */ if (isDeal) { +/* 304 */ int commaPos = this.lastOfferReceived.indexOf(","); +/* 305 */ if ((commaPos < 0) || +/* 306 */ (!offer.equals(this.lastOfferReceived.substring(commaPos + 1)))) +/* */ { +/* */ +/* */ +/* */ +/* */ +/* 312 */ Object[] arguments = { new String(this.partner) }; +/* 313 */ this.whisperPart.println(MessageFormat.format( +/* 314 */ Console.message("proposed-deal"), arguments)); +/* 315 */ if (commaPos < 0) { +/* 316 */ commaPos = this.lastOfferReceived.length(); +/* 317 */ if (this.lastOfferReceived.equals("cancel")) { +/* 318 */ commaPos = 0; +/* */ } +/* */ } +/* */ } +/* 322 */ String newOffer = this.lastOfferReceived.substring(0, commaPos) + "," + +/* 323 */ offer; +/* */ +/* 325 */ this.lastOfferSent = newOffer; +/* 326 */ offer = offer + "," + this.lastOfferReceived.substring(0, commaPos); +/* */ } else { +/* 328 */ String lastSent = this.lastOfferSent; +/* 329 */ int commaPos = lastSent.indexOf(","); +/* */ +/* */ +/* */ +/* 333 */ if ((onlyIfChanged) && (offer.equals(lastSent.substring(commaPos + 1)))) { +/* 334 */ return; +/* */ } +/* 336 */ this.lastOfferSent = offer; +/* */ } +/* */ +/* */ +/* 340 */ displayOffer(ourPartOfOffer, this.yourOffer); +/* */ +/* 342 */ this.whisperPart.say("&|+trade>" + offer); +/* */ +/* */ +/* */ +/* 346 */ if (isDeal) { +/* 347 */ sendTradeMessage( +/* 348 */ "&|+deal>" + this.whisperPart.getPartner() + " " + offer); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public static String buildInvDesc(Hashtable<String, InventoryItem> inv) +/* */ { +/* 360 */ String str = ""; +/* 361 */ Enumeration<InventoryItem> invEnum = inv.elements(); +/* 362 */ InventoryManager im = InventoryManager.getInventoryManager(); +/* */ +/* */ +/* */ +/* 366 */ if (invEnum.hasMoreElements()) { +/* 367 */ Object obj = invEnum.nextElement(); +/* 368 */ if (obj != null) { +/* 369 */ InventoryItem invItem = (InventoryItem)obj; +/* 370 */ str = str + im.itemName(invItem); +/* */ } +/* */ +/* 373 */ while (invEnum.hasMoreElements()) { +/* 374 */ obj = invEnum.nextElement(); +/* 375 */ InventoryItem invItem = (InventoryItem)obj; +/* 376 */ str = str + ", "; +/* 377 */ str = str + im.itemName(invItem); +/* */ } +/* */ } +/* */ +/* */ +/* 382 */ return str; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ protected void cancelTrading() +/* */ { +/* 390 */ if ((this.isTrading) && (isActive())) +/* */ { +/* 392 */ this.whisperPart.say("&|+trade>cancel"); +/* */ +/* 394 */ if (this.lastOfferSent.indexOf(",") >= 0) { +/* 395 */ sendTradeMessage("&|+deal>cancel"); +/* */ } +/* 397 */ this.lastOfferSent = ""; +/* */ } +/* */ } +/* */ +/* */ +/* */ protected synchronized boolean done(boolean confirmed) +/* */ { +/* 404 */ cancelTrading(); +/* 405 */ WhisperManager.whisperManager().remove(this.partner); +/* */ +/* 407 */ return super.done(confirmed); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ protected void doneDeal() +/* */ { +/* 415 */ String tradeTerms = ""; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 423 */ InventoryManager im = InventoryManager.getInventoryManager(); +/* 424 */ int commaPos = this.lastOfferSent.indexOf(","); +/* 425 */ if (commaPos >= 0) { +/* 426 */ Hashtable<String, InventoryItem> lost = im.parseInventoryString(this.lastOfferSent +/* 427 */ .substring(commaPos + 1)); +/* */ +/* 429 */ tradeTerms = buildInvDesc(lost); +/* */ +/* 431 */ if (tradeTerms.length() == 0) { +/* 432 */ tradeTerms = "nothing"; +/* */ } +/* 434 */ Hashtable<String, InventoryItem> got = im.parseInventoryString(this.lastOfferSent.substring(0, +/* 435 */ commaPos)); +/* 436 */ String gotTerms = buildInvDesc(got); +/* */ +/* 438 */ if (gotTerms.length() == 0) { +/* 439 */ gotTerms = "nothing"; +/* */ } +/* 441 */ tradeTerms = ": " + tradeTerms + " for " + gotTerms; +/* */ +/* 443 */ setTrading(true); +/* */ +/* 445 */ Object[] arguments = { new String(tradeTerms) }; +/* 446 */ this.whisperPart.println(MessageFormat.format( +/* 447 */ Console.message("Trans-complete"), arguments)); +/* */ } +/* */ } +/* */ +/* */ +/* */ protected void processOffer(boolean startUp) +/* */ { +/* 454 */ if (this.lastOfferReceived.equals("cancel")) { +/* 455 */ this.lastOfferReceived = ""; +/* 456 */ cancelTrading(); +/* 457 */ setTrading(true); +/* 458 */ Object[] arguments = { new String(this.partner) }; +/* 459 */ this.whisperPart.println(MessageFormat.format( +/* 460 */ Console.message("Trans-complete"), arguments)); +/* 461 */ return; +/* */ } +/* */ +/* */ +/* 465 */ String offer = this.lastOfferReceived; +/* */ +/* 467 */ int lastComma = 0; +/* 468 */ int commaPos = offer.indexOf(","); +/* */ +/* 470 */ Object[] arguments = { new String(this.partner) }; +/* */ +/* 472 */ if (commaPos < 0) +/* */ { +/* 474 */ if (!startUp) { +/* 475 */ this.whisperPart.println(MessageFormat.format( +/* 476 */ Console.message("offer-changed"), arguments)); +/* */ } +/* */ +/* */ } +/* 480 */ else if (!offer.equals(this.lastOfferSent)) +/* */ { +/* */ +/* */ +/* 484 */ lastComma = this.lastOfferSent.indexOf(","); +/* 485 */ if (lastComma < 0) { +/* 486 */ lastComma = this.lastOfferSent.length(); +/* */ } +/* */ +/* */ +/* 490 */ if (offer.substring(commaPos + 1).equals(this.lastOfferSent.substring(0, lastComma))) { +/* 491 */ this.whisperPart.println(MessageFormat.format( +/* 492 */ Console.message("proposed-this"), arguments)); +/* */ } +/* */ else +/* */ { +/* 496 */ this.whisperPart.println(MessageFormat.format( +/* 497 */ Console.message("proposed-new"), arguments)); +/* */ } +/* */ } +/* */ +/* */ +/* 502 */ if (commaPos < 0) { +/* 503 */ commaPos = offer.length(); +/* */ } +/* 505 */ displayOffer(offer.substring(0, commaPos), this.hisOffer); +/* */ } +/* */ +/* */ protected synchronized void build() +/* */ { +/* 510 */ if (this.lastOfferSent.equals("")) +/* 511 */ displayOffer("", this.yourOffer); +/* 512 */ if ((this.lastOfferReceived.equals("")) || (this.lastOfferReceived.equals("cancel"))) { +/* 513 */ displayOffer("", this.hisOffer); +/* */ } +/* 515 */ this.building = false; +/* */ +/* 517 */ if (this.built) +/* 518 */ removeAll(); +/* 519 */ this.built = true; +/* */ +/* */ +/* */ +/* 523 */ Color bg1 = new Color(0, 0, 0); +/* 524 */ Color bg2 = new Color(0, 192, 192); +/* 525 */ Color bg2b = new Color(0, 160, 160); +/* 526 */ Color fg1 = new Color(255, 255, 255); +/* 527 */ Color bg5 = bg2; +/* */ +/* */ +/* 530 */ Color bg3 = bg2; +/* 531 */ Color bg4 = bg2; +/* */ +/* */ +/* */ +/* */ +/* */ +/* 537 */ setBackground(this.isTrading ? bg1 : Color.white); +/* 538 */ setForeground(Color.black); +/* */ +/* 540 */ Panel borderPanel = null; +/* */ +/* */ +/* 543 */ if (this.isTrading) { +/* 544 */ borderPanel = new InsetPanel(new BorderLayout(), 6, 10, 12, 11); +/* 545 */ borderPanel.setBackground(bg1); +/* */ +/* */ +/* 548 */ InventoryManager iMgr = InventoryManager.getInventoryManager(); +/* 549 */ Hashtable<String, InventoryItem> inv = iMgr.getInventoryItems(); +/* 550 */ Enumeration<InventoryItem> invEnum = inv.elements(); +/* 551 */ int len = inv.size(); +/* 552 */ this.fieldList = new Vector(len); +/* */ +/* */ +/* */ +/* 556 */ Panel yourInv = new Panel(new GridLayout(1, len == 0 ? 1 : len)); +/* 557 */ yourInv.setBackground(bg2); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 565 */ int i = 0; +/* 566 */ if (inv.size() > 0) { +/* 567 */ while (invEnum.hasMoreElements()) +/* */ { +/* */ +/* 570 */ InventoryItem invItem = (InventoryItem)invEnum.nextElement(); +/* 571 */ Panel p = new Panel(new BorderLayout()); +/* 572 */ p.setFont(font); +/* 573 */ p.setBackground((i & 0x1) == 1 ? bg2 : bg2b); +/* */ +/* 575 */ MultiLineLabel nm = new MultiLineLabel( +/* 576 */ iMgr.itemName(invItem), 3, 0); +/* 577 */ p.add("North", nm); +/* */ +/* 579 */ ImageCanvas im = new ImageCanvas( +/* 580 */ invItem.getItemGraphicLocation()); +/* 581 */ Panel ins = new InsetPanel(new BorderLayout(), 5, 15, 5, 15); +/* 582 */ ins.add("Center", im); +/* 583 */ ins.setBackground((i & 0x1) == 1 ? bg2 : bg2b); +/* 584 */ p.add("Center", ins); +/* */ +/* 586 */ Panel p2 = new Panel(new BorderLayout()); +/* 587 */ p2.setFont(font); +/* */ +/* 589 */ TextField tf = new TextField("", 1); +/* 590 */ tf.setFocusable(true); +/* 591 */ tf.setFont(font); +/* 592 */ this.fieldList.addElement(tf); +/* 593 */ p2.add("West", tf); +/* */ +/* 595 */ nm = new MultiLineLabel("of " + invItem.getItemQuantity(), +/* 596 */ 3, 0); +/* 597 */ p2.add("Center", nm); +/* 598 */ p2.add("South", new FixedSizePanel(5, 25)); +/* */ +/* 600 */ p.add("South", p2); +/* */ +/* */ +/* 603 */ yourInv.add(p); +/* 604 */ i++; +/* */ } +/* */ } else { +/* 607 */ Label nm = new Label(Console.message("You-have-nothing")); +/* */ +/* 609 */ yourInv.add(nm); +/* */ } +/* */ +/* 612 */ this.scrollPane = new WideScrollPane(yourInv, true); +/* 613 */ this.scrollPane.setBackground(bg2); +/* */ +/* 615 */ Panel invLabelPanel = new Panel(new BorderLayout()); +/* 616 */ invLabelPanel.setFont(font); +/* */ +/* 618 */ Label invLabel = new Label(Console.message("Your-inventory")); +/* 619 */ invLabel.setBackground(bg1); +/* 620 */ invLabel.setForeground(fg1); +/* 621 */ invLabelPanel.add("North", invLabel); +/* 622 */ invLabelPanel.add("Center", this.scrollPane); +/* */ +/* */ +/* */ +/* */ +/* 627 */ borderPanel.add("North", invLabelPanel); +/* */ +/* 629 */ Panel offers = new Panel(new GridLayout(1, 2)); +/* */ +/* 631 */ this.scrollPane = new WideScrollPane(this.yourOffer, true); +/* 632 */ this.scrollPane.setBackground(bg5); +/* 633 */ Panel labeledYour = new InsetPanel(new BorderLayout(), 0, 0, 8, 9); +/* 634 */ Label labelYour = new Label(Console.message("Your-offer")); +/* 635 */ labelYour.setBackground(bg1); +/* 636 */ labelYour.setForeground(fg1); +/* 637 */ labeledYour.add("North", labelYour); +/* 638 */ labeledYour.add("Center", this.scrollPane); +/* 639 */ offers.add(labeledYour); +/* */ +/* 641 */ this.scrollPane = new WideScrollPane(this.hisOffer, true); +/* 642 */ this.scrollPane.setBackground(bg5); +/* 643 */ Panel labeledHis = new InsetPanel(new BorderLayout(), 0, 9, 8, 0); +/* 644 */ Object[] arguments = { new String(this.partner) }; +/* 645 */ Label labelHis = new Label(MessageFormat.format( +/* 646 */ Console.message("partner-offer"), arguments)); +/* 647 */ labelHis.setBackground(bg1); +/* 648 */ labelHis.setForeground(fg1); +/* 649 */ labeledHis.add("North", labelHis); +/* 650 */ labeledHis.add("Center", this.scrollPane); +/* 651 */ offers.add(labeledHis); +/* */ +/* */ +/* 654 */ Panel insDeal = new InsetPanel(new BorderLayout(), 8, 18, 8, 18); +/* 655 */ insDeal.setBackground(bg1); +/* 656 */ insDeal.add("Center", offers); +/* 657 */ insDeal.add("South", this.confirmBox); +/* */ +/* 659 */ borderPanel.add("Center", insDeal); +/* */ +/* 661 */ processOffer(true); +/* */ } +/* */ +/* 664 */ this.whisperPart.line.setBackground(this.isTrading ? bg4 : Color.white); +/* */ +/* 666 */ if (this.isTrading) { +/* 667 */ if (!this.isBroadcast) { +/* 668 */ Panel listenPane = new Panel(new BorderLayout()); +/* */ +/* 670 */ this.whisperPart.listen.setBackground(bg3); +/* 671 */ Object[] arguments = { new String(this.partner) }; +/* 672 */ Label whispLabel = new Label(MessageFormat.format( +/* 673 */ Console.message("Whispers-with"), arguments)); +/* 674 */ whispLabel.setBackground(bg1); +/* 675 */ whispLabel.setForeground(fg1); +/* 676 */ listenPane.add("North", whispLabel); +/* 677 */ listenPane.add("Center", this.whisperPart.listen.getComponent()); +/* 678 */ listenPane.add("South", this.whisperPart.line); +/* */ +/* 680 */ borderPanel.add("South", listenPane); +/* */ } else { +/* 682 */ borderPanel.add("South", this.whisperPart.line); +/* */ } +/* */ +/* 685 */ add(borderPanel); +/* */ } else { +/* 687 */ this.whisperPart.listen.setBackground(Color.lightGray); +/* */ +/* 689 */ Panel insListen = new InsetPanel(new BorderLayout(), 3, 1, 1, 1); +/* 690 */ insListen.setBackground(Color.lightGray); +/* 691 */ insListen.add("Center", this.whisperPart.listen.getComponent()); +/* 692 */ add("Center", insListen); +/* */ +/* 694 */ Panel insLine = new InsetPanel(new BorderLayout(), 2, 1, 2, 1); +/* 695 */ insLine.setBackground(Color.lightGray); +/* 696 */ insLine.add("Center", this.whisperPart.line); +/* 697 */ add("South", insLine); +/* */ } +/* */ +/* 700 */ validate(); +/* */ } +/* */ +/* */ protected synchronized void print(String msg) +/* */ { +/* 705 */ if (msg.startsWith("&|+trade>")) { +/* 706 */ if (!this.isTrading) { +/* 707 */ setTrading(true); +/* */ } +/* 709 */ this.lastOfferReceived = msg.substring(9); +/* 710 */ if (!this.building) +/* 711 */ processOffer(false); +/* 712 */ } else if (!msg.startsWith("&|+")) { +/* 713 */ this.whisperPart.println("> " + msg); +/* */ } +/* */ } +/* */ +/* */ @Deprecated +/* */ public synchronized boolean keyDown(Event event, int key) +/* */ { +/* 720 */ if (!this.isTrading) { +/* 721 */ this.whisperPart.line.requestFocus(); +/* */ } else { +/* 723 */ this.keyChange = 2; +/* */ } +/* 725 */ if (key == 10) +/* */ { +/* 727 */ this.whisperPart.trigger(); +/* 728 */ return true; +/* */ } +/* 730 */ return false; +/* */ } +/* */ +/* */ public Dimension getPreferredSize() { +/* 734 */ Dimension d = super.getPreferredSize(); +/* 735 */ if (d.width < 400) +/* 736 */ d.width = 400; +/* 737 */ if (d.height < 400) { +/* 738 */ d.height = 400; +/* */ } +/* 740 */ return d; +/* */ } +/* */ +/* */ public Dimension getMinimumSize() +/* */ { +/* 745 */ Dimension d = super.getMinimumSize(); +/* 746 */ if (d.width < 400) +/* 747 */ d.width = 400; +/* 748 */ if (d.height < 400) { +/* 749 */ d.height = 400; +/* */ } +/* 751 */ return d; +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\TradeDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |