Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6720447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:12:47+00:00 2026-05-26T09:12:47+00:00

I have designed a form using WindowBuilder Pro , part of the generated code

  • 0

I have designed a form using WindowBuilder Pro, part of the generated code is:

JPanel panel = new JPanel();

I’m trying to make my own JPanel, with paint method:

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;
    }

}

Unfortunately, changing the constructor to:

JPanel panel = new DisplayPanel();

causes an error when switching to design view:

 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)

Is this a bug? Or is there a different way to do this?

I tried setting the subclass in the gui designer, with right-click, Morph-subclass, but when I select DisplayPanel it gives an error:

new DisplayPanel((Mainwin) null) is not valid source for component creation, it references not existing constructor. 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:12:48+00:00Added an answer on May 26, 2026 at 9:12 am

    I moved the DisplayPanel from a private class in the window class, to a separate class. This eliminates the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked at the generated designer code of Form s and UserControl s,
I have designed a form using labels and textboxes and included validation but when
In my WPF App, I have designed the Form using Expression Blend. To my
I have designed a custom panel which can expand or collapse form at run
I have designed one sign-up form,in this form after getting all necessary values I
I have Designed the Javascript function My.js it contains following code My.js function display(){
I have designed a new web site. I have hosted it online. I want
I have a doubt in layouts.I have designed one layout using group layout using
I have a dynamically generated form with input fields with the same name (for
I have a web report that uses a Django form (new forms) for fields

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.