This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Any new class that is referenced in typed-in code or code produced with the assistance of code completion should automatically be imported (like it is in Eclipse). At the moment it will first display the line with the squiggly red line under it and then you have to go to Source->Fix Imports to get it to happen. Why not just have it automatic?
Perhaps the functionality of automatic imports should be optional so that those who prefer the older system can have it still.
Necessary imports are already added when item from code completion is selected.
Auto-importing has to solve the problem of reasonably inferring the intentions of the programmer- do they want to import a class or create a class or create an inner class? It's impossible to know for sure, but something like the following would go a long way to enhancing auto-import. Netbeans should auto-import when a class unambiguously matches one in packages which are 1) very common (java.* javax.* etc.). For example, I am guessing that most people use the libs in the JDK, even though there classes with the same names in say, trove. People using trove often times want it for ONE package or even a specific class. So an option would be to always auto-import from the JDK even if matching trove classes were found. satisfactory tweaking of this default behaviour might be achievable using 3 below . 2) OR listed explicitly by the developer on a configuration screen. 3) AND not on a developer-specified excludes list (say if I were creating my own swing widgets with the same names as the original swing widgets, then I might want to exclude swing from auto-import) HTH
If this is implemented, then there should be a way to disable it. IMHO, I would not like IDE making decisions for me: would lead to bugs of difficult identification. Perhaps, when I work with GWT, lots of classes has similar names as the ones found in Swing and other packages, and sometimes I have to correctly choose from one or other.