Why java.awt.event is to be imported separately when already java.awt package is imported?
It is a very general doubt uncleared in many minds. To get the clear answer, first you must know how the packages are maintained by Java with the colloboration of OS. A package of Java is treated as a directory by the OS. It is proved with -d option of javac utility. On the name of the package, a directory is created by the OS, which you can see practically. All this we know in "Creating user-defined packages".
Now come to our point.
Why both java.awt java.awt.event ?
When we look into "/java/awt>" with dir command, the OS shows the files and subdirectories of awt. It shows clearly that event subdirectory exists; but it is not opened. To see the files of event directory, we must go to "/java/awt/event>" and give the dir command.
That is, with java.awt, the event subpackage is imported but it classes are not opened and thereby not available to the program. To use the classes of event sub package, it is necessary to import explicitly java.awt.event package; else compiler raises error saying "cannot resolve symbol".