JOptionPane.YES_NO_OPTION);
if(JOptionPane.YES_OPTION==choice)
return lastCard;
}
NamedObject[] names=new NamedObject[compatibleCards.size()+1];
names[0]=new NamedObject("Cancel",new Integer(-1));
for(int i=0;i<compatibleCards.size();i++)
names[i+1]=new NamedObject(compatibleCards.get(i).getIdentifiableCardDescription(), new Integer(i));
NamedObject o = (NamedObject) JOptionPane.showInputDialog(
null,
"The card could not be identified as one of the supported cards.\n"+
"Please select a card model to continue or select \"Cancel\".",
"Card model selection",
JOptionPane.QUESTION_MESSAGE,
null,
names,
names[0]);
if((null==o) || (-1==((Integer)o.getObject()))){
String msg="The card could not be identified as one of the supported cards and manual selection has been cancelled. Supported cards:\n";
for(int i=0;i<compatibleCards.size();i++)
msg+=compatibleCards.get(i).getIdentifiableCardDescription()+"\n";
throw new StopRequestFromUserException(msg);
}
index=(Integer)o.getObject();
lastWasSelectedByUser=true;
}
lastCard=compatibleCards.get(index);
lastAtr=atr;
return lastCard;