Let’s say you have a project with package Example, and in that package you have:
Example.java // troublemaker! ExampleUI.java // "form" - extends JFrame LabelExample.java // extends JLabel
One of the cool things about the Matisse GUI Editor in NetBeans is that you can add LabelExample.java as a custom component to the widget palette and then drop an instance of it on your ExampleUI.java form in design mode. NetBeans will generate the source code for you.
However, there is a little hitch. When NetBeans creates the variable declaration, it will use the fully qualified path of your class, in this case Example.LabelExample, and then the IDE (which is chanelling the compiler), will complain with:

That is, here is your generated code block:
// Variables declaration - do not modify private Example.LabelExample labelExample1; // End of variables declaration
And this is the error:
cannot find symbol symbol : class LabelExample location: class Example.Example
I guess it’s confused about which “Example” you mean, the package or the class. In the screenshot above, you can see that private LabelExample labelExample2; doesn’t have the same problem. Normally I wouldn’t use the full path in this situation, but in this case the IDE is choosing it for you, and you can’t modify that code block, so you’re stuck. (Well, I seem to remember seeing that there is some way to modify it, but it’s not recommended.)
It seems obvious now, but I really stumbled and bumbled around with this one on my way to enlightenment. I’m hoping to save at least one person the same frustration. Maybe I should mention that I was hung up on a JPanel component, in case that’s what you’re searching for. :-)
It looks like this is only a problem if you have just that one layer of package. Package Sample.Example with Example.java works fine. In general I construct my packages with lower case directory names, but not always on the leaf package dir, and not always on a simple project where I just have a single directory package. (Maybe I should change my ways, although now I know better in this one unusual situation.)

