private void cleanup() { location = getLocation(); saveWindow.saveLocation(location); dispose(); // Accept or Fight, the Negotiate dialog in which one could make // further proposals is not needed any more if (proposal != null) { gui.cleanupNegotiationDialogs(); } gui.negotiateCallback(proposal, false); }
ReplyToProposal( JFrame parentframe, ClientGUI gui, String playerName, Options options, Proposal proposal) { super(parentframe, playerName + ": Reply to Proposal", false); this.proposal = proposal; this.gui = gui; attacker = proposal.getAttacker(); defender = proposal.getDefender(); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); setBackground(Color.lightGray); int scale = 4 * Scale.get(); JPanel attackerPane = new JPanel(); contentPane.add(attackerPane); attackerMarker = new Marker(attacker, scale, attacker.getLongMarkerId(), gui.getClient(), true); attackerPane.add(attackerMarker); List<String> attackerImageNames = gui.getOracle().getLegionImageNames(attacker); Iterator<String> it = attackerImageNames.iterator(); while (it.hasNext()) { String imageName = it.next(); Chit chit = Chit.newCreatureChit(scale, imageName); attackerChits.add(chit); attackerPane.add(chit); } JPanel defenderPane = new JPanel(); contentPane.add(defenderPane); defenderMarker = new Marker(defender, scale, defender.getLongMarkerId(), gui.getClient(), true); defenderPane.add(defenderMarker); List<String> defenderImageNames = gui.getOracle().getLegionImageNames(defender); it = defenderImageNames.iterator(); while (it.hasNext()) { String imageName = it.next(); Chit chit = Chit.newCreatureChit(scale, imageName); defenderChits.add(chit); defenderPane.add(chit); } if (proposal.isMutual()) { markAllDead(attacker); markAllDead(defender); } else if (attacker.equals(proposal.getWinner())) { markAllDead(defender); markSomeDead(attacker, proposal.getWinnerLosses()); } else if (defender.equals(proposal.getWinner())) { markAllDead(attacker); markSomeDead(defender, proposal.getWinnerLosses()); } JPanel buttonPane = new JPanel(); contentPane.add(buttonPane); JButton button1 = new JButton("Accept"); button1.setMnemonic(KeyEvent.VK_A); JButton button2 = new JButton("Decline"); button2.setMnemonic(KeyEvent.VK_D); JButton button3 = new JButton("Fight"); button3.setMnemonic(KeyEvent.VK_F); buttonPane.add(button1); button1.addActionListener(this); buttonPane.add(button2); button2.addActionListener(this); pack(); saveWindow = new SaveWindow(options, "ReplyToProposal"); location = saveWindow.loadLocation(); if (location == null) { centerOnScreen(); location = getLocation(); } else { setLocation(location); } setVisible(true); repaint(); }