adeeb, I'm starting to get the impression that you are just coding, and every single problem you encounter will have you open a
thread on this board. Therefore, I would like to ask you to
ShowSomeEffort and
SearchFirst.
If you would have used the search you would have encountered many similar problems - including at least one from yourself. But let me help you again this time.
Let's take a step by step look at your exception's stack trace:
That tells us that in the main thread (the one that is started for the main method) a NullPointerException (NPE) has occurred.
That NPE is caused by line 1027 in the source of java.awt.Container, in method addImpl. Since this is an API class either you've found a bug (not very likely) or you are using the method wrongly. So let's continue with the next line.
Well another API call, so let's continue again.
Hey, that looks like your own class! In file library.java, at line 341 in the constructor (<init>) you do something that causes the NPE. Looking back one line it is adding something to a Container (JPanel extends Container indirectly). Since the Container itself isn't null (then this would be the first line) it must be the object passed to the add method. Guess you forgot to initialize a component. Again might I add - the last similar problem you posted was almost exactly the same problem. Anyway, continuing.
Any other lines are just where your method call started. In the end, it will most likely end with the main method or the AWT EventQueue.
So now you know how to read stack traces: start from top to bottom until you find a method and class not in the API, and fix the problem there.
[ June 15, 2008: Message edited by: Rob Prime ]