1 Mar 01:42
Re: NetBeans 6.5 gets error when switching to design view
Peter B. West <lists <at> pbw.id.au>
2009-03-01 00:42:22 GMT
2009-03-01 00:42:22 GMT
raysaun wrote: > Well, I finally figured this one out after I found the IDE Log. It appears that the IDE executes the constructor of the classes containing swing items in order to display the window when Design is selected. If a constructor contains any references to a class which will only be satisfied at run time, the reference will not be initialized and a null pointer exception will occur. > > ------------------------ > Ray Saunders I've recently been through the same problem. I'm glad you were able to work this out. The behaviour of the GUI builder was explained to me by one of the NB team. In essence, the components you add to the GUI are beans. I had only a very loose understanding of beans, so I went back and read the spec. They are designed to enable higher-level composition by toolkits, and their naming conventions allow such toolkits to instantiate and manipulate the bean, including the getting and setting of fields, the events that the bean reports, and the accessible methods. A BeanInfo class can be provided to override some or all of this information. Beans include the notion of design time and run time. The Beans utility class includes the static method isDesignTime() which can be used to differentiate the cases, in, for example, your constructor. If you have runtime dependencies in any component, you should probably protect all areas with ( ! Beans.isDesignTime() ). That's about as far as I've gone with this.(Continue reading)
RSS Feed