code_junkie

What is this java.awt.event error?

Nov 12th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public void actionPerformed(ActionEvent e) {
  2. String cmd = e.getActionCommand();
  3. String name;
  4.  
  5. code...
  6.  
  7. if(cmd.equals("Play")) {
  8. name = field.getText();
  9. card = getCard(name);
  10.  
  11. if(card != null) {
  12. if(rules.zoneHasCard(card, rules.hand)) {
  13. display.updateStatusMessage(rules.play(card));
  14. field.setText("");
  15. display.updateHand(rules.zoneList("hand"));
  16. display.updateDiscard(rules.zoneList("Discard")); // This is the error here! The discard Zone was empty!
  17. }
  18. else {
  19. field.setText("You do not have " + card.getName());
  20. field.selectAll();
  21. }
  22. }
  23. else {
  24. field.setText("That cardname is unused");
  25. field.selectAll();
  26. }
  27. }
  28. }
  29.  
  30. public void actionPerformed(ActionEvent e) {
  31. String cmd = e.getActionCommand();
  32. String name;
  33.  
  34. // more code...
  35. }
  36.  
  37. System.out.println("field = " + field);
  38. System.out.println("rules = " + rules);
  39. System.out.println("display = " + display);
Add Comment
Please, Sign In to add comment