public String[] getPropertyName() { String[] save = new String[x.getProperties().size()]; for (int i = 0; i < x.getProperties().size(); i++) { save[i] = (Game.SlotsList[x.getProperties().get(i)]).getName(); } return save; }
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { p5.add(mortgage); Slot pobject; pobject = Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())]; if (pobject instanceof Property) { ((Property) (pobject)).monopolizeProperty(); pr1.setText("Buy Price:" + pobject.getBuyPrice()); pr2.setText("Rent Price:" + pobject.getRentPrice()); pr3.setText("House Price:" + pobject.getHousePrice()); pr4.setText("Hotel Price:" + pobject.getHotelPrice()); pr5.setText("Mortgaged:" + pobject.getMortgage()); } else if (pobject instanceof Railroad) { pobject.adjustRentPrice(); pr1.setText("Buy Price:" + pobject.getBuyPrice()); pr2.setText("Rent Price:" + pobject.getRentPrice()); pr3.setText(""); pr4.setText(""); pr5.setText(""); } else { pobject.adjustDiceFactor(); pr1.setText("Buy Price:" + pobject.getBuyPrice()); pr2.setText("Dice Factor:" + pobject.getDiceFactor()); pr3.setText(""); pr4.setText(""); pr5.setText(""); } } }
public void actionPerformed(ActionEvent e) { String event = e.getActionCommand(); moneyLabel.setText("Money Owned:" + x.getMoney() + ""); jcards.setText("Get out of Jail Cards Owned: " + x.getJailCards()); if (event.equals("mortgage") && (Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())] instanceof Property)) { Slot pobject = Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())]; if (pobject.getMortgage()) { if (JOptionPane.showConfirmDialog( null, "Would you like to unmortgage your property for $" + pobject.getMortgageV() * 1.10, "Mortgage Choice", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { pobject.endMortgage(); } else { } } else { if (JOptionPane.showConfirmDialog( null, "Would you like to mortgage your property for $" + pobject.getMortgageV(), "Mortgage Choice", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { pobject.mortgageProperty(); } else { } } // WIP Code! } else if (event.equals("buyHouse")) { HouseMenu one = new HouseMenu( x, "buy"); // pass along the player and what sort of thing the player wants to be doing one.setVisible(true); do { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException a) { // nothing } } while (one.done == false); one.dispose(); } else if (event.equals("sellHouse")) { HouseMenu one = new HouseMenu(x, "sell"); one.setVisible(true); do { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException a) { // nothing } } while (one.done == false); one.dispose(); } else { Property choice = (Property) (Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())]); int res = JOptionPane.showConfirmDialog( null, "Are you sure you want to sell this property, along with any houses and hotels?", "Confirm your choice", JOptionPane.YES_NO_OPTION); if (res == JOptionPane.YES_OPTION) { choice.sellProperty(); } else { // nothing } } }