c.gridx = 0;
c.gridy = 0;
Color color = HTMLColors.black;
final ILandOwner owner = companyCell.owner();
if (owner instanceof Player) {
color = ((Player) owner).color();
}
infoDialog.add(new JLabel("<html>"
+ "Игрок <font color=" + HTMLColors.getName(p.color()) + ">"
+ "\"" + p.name() + "\"</font>" + "остановился на ячейки"
+ " являющейся фирмой <u>\"" + companyCell.name() + "\"</u>"
+ " и принадлежащей игроку <font color="
+ HTMLColors.getName(color) + ">\"" + owner.name()
+ "\"</font>.<br>"
+ "Оплатите арендную плату в размере <i>"
+ companyCell.rent() + "$.</i>"
+ "</html>"), c);
JButton okbttn = new JButton("OK");
okbttn.setAlignmentX(JComponent.CENTER_ALIGNMENT);
okbttn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
_canPlayerPaidRent = false;
GameViewEvent event = new GameViewEvent(this, p,
companyCell);
fireMadePlayerPayRent(event);
infoDialog.dispose();
}
});
c.fill = GridBagConstraints.NONE;
c.gridy = 1;
infoDialog.add(okbttn, c);
infoDialog.pack();
infoDialog.setLocationRelativeTo(this);
infoDialog.setResizable(false);
infoDialog.setVisible(true);
if (_canPlayerPaidRent == true) {
final Dialog dialog = new JDialog();
dialog.setModal(true);
dialog.setTitle("Игрок \"" + p.name() + "\"");
dialog.setLayout(new GridBagLayout());
c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(5, 5, 5, 5);
final JLabel questionLbl = new JLabel();
final JLabel amountLbl = new JLabel();
final JSpinner amountSpr = new JSpinner();
final JButton ybttn = new JButton("Да");
ybttn.setAlignmentX(JComponent.CENTER_ALIGNMENT);
final JButton nbttn = new JButton("Нет");
nbttn.setAlignmentX(JComponent.CENTER_ALIGNMENT);
c.gridx = 0;
c.gridy = 0;
dialog.add(questionLbl, c);
c.gridx = 0;
c.gridy = 1;
dialog.add(amountLbl, c);
c.gridx = 0;
c.gridy = 2;
dialog.add(amountSpr, c);
c.gridx = 0;
c.gridy = 3;
c.fill = GridBagConstraints.NONE;
dialog.add(ybttn, c);
c.gridx = 0;
c.gridy = 4;
dialog.add(nbttn, c);
questionLbl.setText("<html>"
+ "Желаете попробывать перекупить у игрока <font color="
+ HTMLColors.getName(color) + ">\"" + owner.name()
+ "\"</font> фирму <u>\"" + companyCell.name()
+ "\"</u>?"
+ "</html>");
amountLbl.setText("Предложить сумму ($):");
SpinnerModel sprModel = new SpinnerNumberModel(
companyCell.cost(), companyCell.cost(),
companyCell.cost() * 10, 1000);
amountSpr.setModel(sprModel);
ybttn.setActionCommand("P1");
ybttn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
if ("P1".equals(actionCommand)) {
dialog.setTitle("Игрок \"" + owner.name() + "\"");
questionLbl.setText("<html>"
+ "Игрок <font color="
+ HTMLColors.getName(p.color()) + ">\""
+ p.name() + "\"</font> предложил вам "