title: Custom JPanel with WindowBuilder causes crash
body: <p>I have designed a form using <a href="http://code.google.com/javadevtools/wbpro/quick_start.html" rel="nofollow">WindowBuilder Pro</a>, part of the generated code is:</p>
  
  <pre><code>JPanel panel = new JPanel();
  </code></pre>
  
  <p>I'm trying to make my own JPanel, with paint method:</p>
  
  <pre><code>private class DisplayPanel extends JPanel {
  
      public DisplayPanel() {
          // TODO Auto-generated constructor stub
      }
      @Override
      protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          //Paint the graph. Note that x is to the right, y is down.
          g.setColor(Color.black);
          g.drawRect(0,0,this.getWidth()-1,this.getHeight()-1);
      }
      @Override
      public boolean mouseDrag(Event evt, int x, int y) {
          System.out.println(x+", "+y);
          return false;
      }
  
  }
  </code></pre>
  
  <p>Unfortunately, changing the constructor to:</p>
  
  <pre><code>JPanel panel = new DisplayPanel();
  </code></pre>
  
  <p>causes an error when switching to design view: </p>
  
  <pre><code> WindowBuilder encountered unexpected internal error.
  
  This could be caused by a WindowBuilder bug or by a misconfiguration issue, conflict, partial update, etc.
  
  java.lang.NullPointerException: Argument must not be null
  Stack trace:
  
  java.lang.NullPointerException: Argument must not be null
      at javax.swing.Spring.checkArg(Spring.java:671)
      at javax.swing.Spring.width(Spring.java:640)
      at javax.swing.SpringLayout.applyDefaults(SpringLayout.java:1074)
      at javax.swing.SpringLayout.putConstraints(SpringLayout.java:1105)
      at javax.swing.SpringLayout.getConstraints(SpringLayout.java:1140)
      at javax.swing.SpringLayout$SpringProxy.getConstraint(SpringLayout.java:829)
      at javax.swing.SpringLayout$SpringProxy.isCyclic(SpringLayout.java:853)
      at javax.swing.SpringLayout.isCyclic(SpringLayout.java:907)
      at javax.swing.Spring$CompoundSpring.isCyclic(Spring.java:460)
      at javax.swing.SpringLayout.isCyclic(SpringLayout.java:907)
      at javax.swing.SpringLayout.abandonCycles(SpringLayout.java:919)
      at javax.swing.SpringLayout.layoutContainer(SpringLayout.java:1209)
      at java.awt.Container.layout(Container.java:1421)
      at java.awt.Container.doLayout(Container.java:1410)
      at java.awt.Container.validateTree(Container.java:1507)
      at java.awt.Container.validateTree(Container.java:1513)
      at java.awt.Container.validateTree(Container.java:1513)
      at java.awt.Container.validateTree(Container.java:1513)
      at java.awt.Container.validate(Container.java:1480)
      at org.eclipse.wb.internal.swing.model.component.top.WindowTopBoundsSupport.apply(WindowTopBoundsSupport.java:67)
      at org.eclipse.wb.core.model.AbstractComponentInfo.refresh_afterCreate(AbstractComponentInfo.java:241)
      at org.eclipse.wb.core.model.ObjectInfo.refreshCreate0(ObjectInfo.java:535)
      at org.eclipse.wb.core.model.ObjectInfo.access$0(ObjectInfo.java:529)
      at org.eclipse.wb.core.model.ObjectInfo$5$1.run(ObjectInfo.java:486)
      at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:139)
      at org.eclipse.wb.core.model.ObjectInfo$5.run(ObjectInfo.java:484)
      at org.eclipse.wb.internal.swing.utils.SwingUtils$2.run(SwingUtils.java:76)
      at org.eclipse.wb.internal.swing.utils.SwingUtils.invokeLaterAndWait(SwingUtils.java:180)
      at org.eclipse.wb.internal.swing.utils.SwingUtils.runLaterAndWait(SwingUtils.java:73)
      at org.eclipse.wb.internal.swing.model.component.ComponentInfo.doRefresh(ComponentInfo.java:118)
      at org.eclipse.wb.core.model.ObjectInfo.refresh(ObjectInfo.java:482)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:559)
      at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:501)
      at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:434)
      at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
      at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
      at org.eclipse.swt.widgets.Display.syncExec(Display.java:4113)
      at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:431)
      at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
      at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
      at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:450)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:400)
      at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
      at org.eclipse.wb.internal.core.editor.UndoManager.activate(UndoManager.java:90)
      at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState_True(DesignPage.java:248)
      at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState(DesignPage.java:226)
      at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
      at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode$1.widgetSelected(DefaultMultiMode.java:63)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1200)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1185)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1025)
      at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3256)
      at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045)
      at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:323)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
      at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
  </code></pre>
  
  <p>Is this a bug? Or is there a different way to do this?</p>
  
  <p>I tried setting the subclass in the gui designer, with right-click, Morph-subclass, but when I select DisplayPanel it gives an error:</p>
  
  <pre><code>new DisplayPanel((Mainwin) null) is not valid source for component creation, it references not existing constructor. 
  </code></pre>