This post originated from an RSS feed registered with Java Buzz
by Scott Delap.
Original Post: SwingSet2 Needs a Package
Feed Title: ClientJava.com
Feed URL: http://www.clientjava.com/archives/wireless_mobile.rdf
Feed Description: Client/Desktop Related Java Development
Have you ever set out to do something extremely simple only to have it turn into a 2 hour ordeal? This evening I was working on a simple example of a custom MetalTheme. I thought I'd be nice and launch SwingSet2 from my example framework using the new theme. Sounds simple enough. As I was coding the constructor I noticed IntelliJ didn't ask me if I wanted to import SwingSet2. Ignoring this abnormality I added:
import SwingSet2;
I was promptly greeted with this upon compile:
'.' expected
WTF, this class exists and now I can't use it. A quick Google search turned up Importing Unamed Packages. Apparently as of some 1.4 release, you can't import a class without a package. I thought about modifying the SwingSet2 code but that seemed counter productive since I would have to modify all the other "special" classes in the SwingSet2 demo that think they are too good to need a package. So I opted for the alternative solution presented on the page I found on Google. I installed a copy of Java 1.3.1 on my Windows box and created a wrapper class with a package that contains a method to launch SwingSet2. I then copied the compiled class into the classpath of the IntelliJ project on my OS X machine and all is happy ... an hour after I started.