Some time back I had written a Space combat based Java game. Reasonably long, 9 stages, many types of weapons and enemies. I wrote a tutorial describing how I wrote it. This is what it looks like.
Read about the coding of the game and java gaming in general.