I am doing a program to implement a simple version of blackjack as an applet.
I have four classes:
- Game21Pane(extends Panel):
It has a canvas to display the card users pick and the game state where they are currently at. It also has three buttons (start, pick and restart) and three button listeners for those buttons
- GameCanvas(extends Canvas):
It is designed to paint the canvas object in Game21Pane
- displayThread(implement runnable):
It call GameCanvas to actually do the painting
- GameApplet:
I use this the call the main applet program.
My question is:
What kind of design pattern can i use to make my code easier to be understand and maintained?
My original thought would be call canvas inside my runnable class, and then call runnable inside my button listener. But does it seem to be a high coupling design? I could not come up with a good way to put everything together.
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire