Here is a slight variation on example I got from the web..
The problems you were having basically related to thos etwo lines because they were referencing classes which you obviously don't have, or at least that aren't in the right place. WindowUtilities, for example, is not core Java. Did you get this as an example off a web site...maybe you need to download some other classes from there if you want to run the example as-is. Looks like Marty Halls's tutorial???