cardPanel.add(button);
}
else if (card instanceof CharacterCard)
{
CharacterCard characterCard = ((CharacterCard)card);
switch(characterCard.getCharacterName())
{
case COL_MUSTARD:
resource = Main.class.getResource("/clueless/main/resources/characters/ColMustard.gif");
break;
case MISS_SCARLET:
resource = Main.class.getResource("/clueless/main/resources/characters/MissScarlett.gif");
break;
case MR_GREEN:
resource = Main.class.getResource("/clueless/main/resources/characters/MrGreen.gif");
break;
case MRS_PEACOCK:
resource = Main.class.getResource("/clueless/main/resources/characters/MissPeacock.gif");
break;
case MRS_WHITE:
resource = Main.class.getResource("/clueless/main/resources/characters/MrsWhite.gif");
break;
case PROF_PLUM:
resource = Main.class.getResource("/clueless/main/resources/characters/ProfPlum.gif");
break;
}
/** get URL to image */
try {
buttonIcon = ImageIO.read(resource);
} catch (IOException e) {
// TODO Auto-generated catch block
System.err.print(e.toString());
}
//Scale it to the UI size
ImageIcon icon = new ImageIcon(buttonIcon.getScaledInstance(96, 150, 0));
//Instantiate image button
CharacterButton button = new CharacterButton(icon, characterCard.getCharacterName());
button.setBorder(new LineBorder(Color.BLACK, 5));
button.setBorderPainted(true);
//add actionEvent to Button
button.addActionListener(new SelectCard());
cardPanel.add(button);