return;
}
int len = Rack.MAX_RACK_LETTERS - player.getRack().getLetters().length();
for (int i = 0; i < len; i++) {
Letter letter = server.pickLetter();
if (letter != null) {
player.getRack().addLetter(letter);
}
}
ppanel.getButton("Validate").setEnabled(false);
ppanel.getButton("Cancel").setEnabled(false);
ppanel.getButton("Reset").setEnabled(false);
ppanel.getButton("Game Over").setEnabled(true);
panel.endTurn();
server.setPlayertable(player.getID(), player.getName(),
null, player.getScore());
}
catch (RemoteException ex) {
Display.error(
"Multiplayer", "Error while changing player turn !");
}
}
}
});
ppanel.getButton("Reset").addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (mainFrame.getGameSelection() == 2) {
List<Integer> selectedLetters = ppanel.action().getLettersToReset();
Iterator<Integer> itr = selectedLetters.iterator();
while (itr.hasNext()) {
int letterToReset = itr.next();
Letter letter = player.getRack().getLetter(letterToReset);
if (letter != null) {
try {
Letter let = server.exchangeLetter(letter);
player.getRack().changeLetter(letterToReset, let);
}
catch (RemoteException ex) {
Display.error("Reset", "Error while reseting letter.");
}