Trying to put the finishing touches on my program for my programming class. Still just trying to wrap my brain on GUI. I believe I have everything working right more or less, but I can't get the new menu item to reset the game board with a new set of cards.
I have attached my code as a .zip file that can be imported into eclipse right away if anyone has a couple minutes to give a college student a couple pointers. I wasn't sure how to embed it below. Its javadoc'd and with comments so it should be pretty easy to read. I've been debugging all day and just can't figure it out.
The program compiles and you can run it as is a see for yourself. Thanks for any suggestions and help. I've tried recalling main which of course just creates another window, and assigning mainPanel to a new call of createGamePanel(). I just can't figure it out.
Well, what you can do is, you can create an ActionListener that listens to the menu item that resets the game and set it in the menu item that resets the game. This ActionListener will have access to the window, and there, you can create a public method that resets the game. This method can instantiate a class that extends Container (and represents the game board) and set it as content. Something like this:
This is just a suggestion of how you can organize your code. Please take a look at that and let us know how it goes!