Is there any advantage/disadvantage to these two types of Import statements:
import javax.swing.*;
and
import javax.swing.JButton;
For the most part, I believe the difference is one of style. Personally, I always use specific imports. I've found, if you ever have to maintain your code months or years down the road (or someone else's code, for that matter), having specific imports can help you track code into various packages. This can be useful if you ever have to update a few areas of an existing application.
Anyway, enough about that, here's a real situation where using package imports can get you into trouble: Namespace Pollution. The problem with using package imports (in this case), is that you end up with class names available for a lot of classes that you're not using. This can lead to ambiguity errors from your compiler. Take the following example:
package java.pets contains the following classes
Dog
Cat
Bird
Fish
package java.dogs contains the following classes
Dog
Bulldog
Chihuahua
CockerSpaniel
Notice that each package contains a class called Dog and a bunch of other classes, as well. Now, look at the following code, in which we make use of the two classes java.pets.Cat and java.dogs.Dog:
In case you didn't catch it, this code won't compile (at least it shouldn't, I haven't tested this). The problem is that the compiler doesn't know which Dog class you mean, either java.pets.Dog or java.dogs.Dog. Both classes have been added to your namespace because of the package imports. This error is a result of namespace pollution - too many names available. There are two ways to solve the problem. 1. Use specific imports. 2. Fully qualify java.dogs.Dog in the declaration of Fido. In this case, I'd say using package imports is more trouble than its worth.
Don't get me wrong, package imports are nice and, even when using specific imports, you can run into namespace problems. Imaging if you have to use both java.pets.Dog and java.dogs.Dog in your program. Even if you use specific import statements, your only choice is to fully qualify the name of the class with the package name. But, I've found this happens
much less often when using specific import statements.
Take it for what it's worth, but I still say it all comes down to style. Namespace issues don't crop up all that often.

Corey