I making web games in java and having troubles each time when getting to the GUI design, usually I'm looking at others codes and copy most of the design, and I can't decide which design I should use. I used Applet, Canvas, JFrame. What I need is the main loop and draw function that changing between different games. So what class should I use and what design, which is better, why, maybe links to useful tutorials and examples... Please explain your suggestion. Thanks.
If you want some code to dissect, you should check out Killer Game Programming in Java
It's a good book, even if it now uses old libraries. I bought it a few years ago. If you don't fancy buying it, you can still download all the source code from the website
You can pretty easily abstract away the choice between using an Applet or Java Web Start. If made to choose, I'd go with JWS, purely because I find it easier to setup a development environment to debug.
These two links demonstrate how to use JFrame v Canvas:
JFrame http://download.oracle.com/javase/tutorial/uiswing/components/frame.html
Canvas http://en.wikibooks.org/wiki/Java_Programming/Canvas
This is the main difference. You could simply do your drawing in a own Canvas (for AWT) or JPanel (for Swing) and put this inside the (J)Applet or (J)Frame, thus abstracting the difference between both away until you are ready to decide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With