Thursday, 10 April 2014

JComboBOx continued

Ahh snake game distractions... -_-

So, more about the JComboBox was done today. I have to make sure that the item I select is actually begin selected, so I added a mouse listener to the drop down menu, which is called listOfCards. I added the mouse listener to it, in the constructor method, where I put all the other mouse listeners that were added to buttons.

I also moved the reset method since it wasn't working as well as it would where it was now. Instead of just calling the method when the player presses the play button, I put it so it calls the restart method when the the program runs. Which means the reset method is also in the constructor method. It will also run when the player presses the back button from within the gameFrame.

I also have a few tracing statements throughout the game so that I'd know it's working properly. I have it show me the cards being dealt to the computer, which usually wouldn't show up in the real game. The player's hand is actually on the screen since the player would have to see it to chose what number to ask the computer.

Next, I made a method that will find the matching numbers. (If there is a number to match) and if there is not a number to match then a window will pop up saying that the computer doesn't have that number, and then another card will be dealt to the player. The player's hand on the screen will plus one card from the deck. Its linked list, playerHand will also have a new node to its list.

If the computer does have the card, then it will remove the card from that list and that card will be added to playerHand's list.

But I haven't done that yet. I just made the method for it and made a value for the item that was selected to check and it's called String selectedValue, or of some such.

No comments:

Post a Comment