Problem with GridBagLayout

I used gridbaglayout in a project i'm writing.Usually, it's suppose to take any number of specified rows or columns but whenever the components are more than 7,it throws a null pointer exception with the following error msgs : java.lang.NullPointerException

at java.awt.Container.addImpl(Container.java:1019)

at java.awt.Container.add(Container.java:351)

at KnowledgeOnWeb1.init(KnowledgeOnWeb1.java:120)

at sun.applet.AppletPanel.run(AppletPanel.java:374)

at java.lang.Thread.run(Thread.java:595)

Is it a peculiar problem with the sdk 1.5 and how do i solve this.

[610 byte] By [feeq_t] at [2007-11-26 12:03:30]
# 1

> Is it a peculiar problem with the sdk 1.5

No - there have been numerous reports of GridbagLayout being able to

successfully cope with 7 or more components.

Sorry. But a Java bug is the very last thing to consider.

> and how do i solve this.

You really need to post a small example tha compiles and shows this

problem when it's run. You will, almost certainly, have to construct this

example, as your existing code will be rather long. In the course of

constructing such an example you may well solve the problem, so it's not

wasted labour.

You should consider posting in the Swing or AWT forums (as appropriate)

as you will get better help there. If you do so, leave a note here saying so.

(My guess is that you're adding a null component.)

pbrockway2 at 2007-7-7 12:28:47 > top of Java-index,Java Essentials,Java Programming...