예제 #1
0
  public ArrayList<Treasure> getSelectedTreasures(JPanel aPanel) {
    TreasureView treasureView;
    ArrayList<Treasure> selected = new ArrayList();

    for (Component treasure : aPanel.getComponents()) {
      treasureView = (TreasureView) treasure;

      if (treasureView.isSelected()) selected.add(treasureView.getTreasure());
    }
    return selected;
  }
예제 #2
0
  public void fillTreasurePanel(JPanel aPanel, ArrayList<Treasure> treasureList) {
    // Se eliminan los elementos y se añaden los nuevos.
    aPanel.removeAll();
    for (Treasure t : treasureList) {
      TreasureView treasureView = new TreasureView();
      treasureView.setTreasure(t);
      treasureView.setVisible(true);
      aPanel.add(treasureView);
    }

    aPanel.repaint();
    aPanel.revalidate();
  }