button.addActionListener(new SelectCard());
cardPanel.add(button);
}
else if (card instanceof LocationCard)
{
LocationCard locationCard = ((LocationCard)card);
switch(locationCard.getLocationName())
{
case BALLROOM:
resource = Main.class.getResource("/clueless/main/resources/rooms/Ballroom.gif");
break;
case BILLIARD_ROOM:
resource = Main.class.getResource("/clueless/main/resources/rooms/BilliardRoom.gif");
break;
case CONSERVATORY:
resource = Main.class.getResource("/clueless/main/resources/rooms/Conservatory.gif");
break;
case DINING_ROOM:
resource = Main.class.getResource("/clueless/main/resources/rooms/DiningRoom.gif");
break;
case HALL:
resource = Main.class.getResource("/clueless/main/resources/rooms/Hall.gif");
break;
case KITCHEN:
resource = Main.class.getResource("/clueless/main/resources/rooms/Kitchen.gif");
break;
case LIBRARY:
resource = Main.class.getResource("/clueless/main/resources/rooms/Library.gif");
break;
case LOUNGE:
resource = Main.class.getResource("/clueless/main/resources/rooms/Lounge.gif");
break;
case STUDY:
resource = Main.class.getResource("/clueless/main/resources/rooms/Study.gif");
break;
}//location card type swtich
/** 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 locationIcon = new ImageIcon(buttonIcon.getScaledInstance(96, 150, 0));
//Instantiate image button
RoomButton locationButton = new RoomButton(locationIcon, locationCard.getLocationName());
locationButton.setBorder(new LineBorder(Color.BLACK, 5));
locationButton.setBorderPainted(true);
locationButton.addActionListener(new SelectCard());
cardPanel.add(locationButton);
}//location else if