Esempio n. 1
0
 /**
  * Helper method makes simple scrollable panel full of possible responses.
  *
  * @param c Character accused
  * @param w Weapon accused
  * @param r Room accused
  * @return scroll panel of buttons
  */
 private JScrollPane cardsPanel(Character c, Weapon w, Room r) {
   JPanel panel = new JPanel(new FlowLayout()); // perhaps boxlayout along x
   JScrollPane pane =
       new JScrollPane(
           panel,
           JScrollPane.VERTICAL_SCROLLBAR_NEVER,
           JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   for (Card crd : player.getCards()) {
     if (crd.toString().equals(c.getName())
         || crd.toString().equals(w.getName())
         || crd.toString().equals(r.toString())) {
       refutable = true;
       JButton l = new JButton(new ImageIcon(crd.getCardImg()));
       final Card refW = crd;
       l.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent arg0) {
               refutedWith = refW;
             }
           });
       l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
       l.setBorder(new EmptyBorder(10, 10, 10, 10));
       panel.add(l);
     }
   }
   return pane;
 }
Esempio n. 2
0
 public void useGetOutOfJailCard() {
   if (cards.isEmpty()) throw new RuntimeException("No tenes ninguna carta.");
   Card card = cards.remove(0);
   card.returnToDeck();
   turns = 0;
   inJail = false;
 }