03 Dec, 02:05PM in sunny Singapore!

Java need urgent help!

Subscribe to Java need urgent help! 1 post

Please Login or Signup to reply.
  • Refugees's Avatar
    264 posts since Nov '04
    • Alright I have been given an assignment to create a Memory Match Game. Now the problem i encounter is .. How can i disable the 2 image buttons after I have match them. Codes as follow.

      public void handleImgBtn(ActionEvent e) {
      for (int i = 0; i < gameBtn.length; i++) {
      if (e.getSource() == gameBtn[i]) {
      g.updateNClick();
      clickTxt.setText("You have clicked " + g.getNClick() +
      " time(s)");
      gameBtn[i].setIcon(card[i].getImg());

      if (g.getNClick() % 2 == 1) {
      value1 = card[i].getImgInt();

      } else if (g.getNClick() % 2 == 0) {
      value2 = card[i].getImgInt();
      if (value1 == value2) {
      g.updateNMatching();

      }
      }

      } //end if
      } //end for
      } //end handleImgBtn()

      P.S: The above codes is only for the matching part only.

Please Login or Signup to reply.