First off, I should put in a little disclaimer about the authorship
of this code. This was an assignment that I did as a freshman last
year for CS108, Stanford's object-oriented programming class. We were
provided with a skeleton of interfaces and utility functions and instructed
to complete the project. So a good deal of credit (I daresay all)
as far as architecting the structure of the code belongs to my professor,
Nick Parlante, and
the rest of the CS108 staff. That being said, I wrote perhaps
80-90% of the working code, so I feel justified in claiming some credit
too :-).
In order to run this program, you'll need a Java compiler and an
implementation of the SWING (GUI stuff) library for your platform.
I believe that this is available at Sun's website, provided that they're
still in business. If you have problems getting this stuff set up,
please don't ask me. I hate the brain-damaged way in which Java programs
have to be set up just so before they will deign to compile. Hearing
about your plight will only ruin my day. Complain to Sun instead,
providing that they're still in business. JTetris is the main class
for the game, though some of the other classes have test mains. This
program is a lot better than some of my others for learning from because
the source is rather well commented. Good luck and have fun!

NOTE: If you are a Stanford student taking CS108
or an equivalent class wherein programming a tetris game is a class
requirement, DO NOT download this code, even to just
peruse it. Not only is it a violation of the honor code, but the CS
department runs all submitted code through tools that are very good
at finding programs that are even semantically similar to previously
submitted material. It's dumb. Don't do it.