unable to added custom swing panel

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

unable to added custom swing panel

Postby NickL » Wed Mar 23, 2005 12:53 pm

Hi,

I am using the "Choose Panel" option in the Swing Designer and am experiencing some difficulty. I have a blank JFrame, create using New->Swing->JFrame. It does have anything in it. I select my class from the dialog box that is presented. The class is extended directly from JPanel with a no arg constructor. It was also created using Swing Designer. After selecting it, I go to place it in the contentPane of the JFrame and I get a circle with a line through it as my cursor. There is nowhere to drop it, doesn't work on the blank contentPane or in the tree view. When I click, simply nothing happens. How can I add my panel to the frame?

I'm running Eclipse 3.1 M5a and Swing Designer 3.0.1 on Windows XP Pro SP2, command line= "C:\Program Files\eclipse\eclipse.exe" -vmargs -Xms128M -Xmx256M
NickL
 

Re: unable to added custom swing panel

Postby Eric Clayberg » Wed Mar 23, 2005 1:11 pm

NickL wrote:I am using the "Choose Panel" option in the Swing Designer and am experiencing some difficulty. I have a blank JFrame, create using New->Swing->JFrame. It does have anything in it. I select my class from the dialog box that is presented. The class is extended directly from JPanel with a no arg constructor. It was also created using Swing Designer. After selecting it, I go to place it in the contentPane of the JFrame and I get a circle with a line through it as my cursor. There is nowhere to drop it, doesn't work on the blank contentPane or in the tree view. When I click, simply nothing happens. How can I add my panel to the frame?

Check your Eclipse ".log" for any errors. Also check your project's /bin directory to make sure that a .class file exists for your JPanel. Designer can't add a custom widget unless it has been compiled and is available on your project's classpath.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

where is eclipse .log

Postby NickL » Thu Mar 24, 2005 6:56 am

Where should I look for the .log file? I checked my /bin, the JPanel is compiled. Eclipse compiles classes automatically, right? Is there some way this could go wrong? I tried cleaning the project and recompiling, didn't help this problem.
NickL
 

more info

Postby NickL » Thu Mar 24, 2005 7:37 am

I should also mention that this worked the first time I tried it, then I added an argument to the constructor of the JPanel and this caused a big red box to appear in the frame instead of my panel.

I removed the argument from the constructor, deleted the red box and tried to reinsert my panel into the frame, but was unable to do so. Like I said, I have cleaned the project, toggled auto building and recomplied everything trying to get it to take but no dice.

Thanks for your help!
NickL
 

Re: where is eclipse .log

Postby Eric Clayberg » Thu Mar 24, 2005 10:46 am

NickL wrote:Where should I look for the .log file?

It is in your <workspace>/.metadata directory.

Custom widgets must also have a zero-argument constructor.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

more info

Postby NickL » Thu Mar 24, 2005 11:19 am

Ok, here's the error that appears in the log when I perform the sequence I described earlier:

com.swtdesigner.properties.PropertyException: java.lang.NullPointerException
at com.swtdesigner.model.swing.component.custom.ContainerBeanWithPropertyChildrenInfo.ensureBeanInstance(ContainerBeanWithPropertyChildrenInfo.java:323)
at com.swtdesigner.model.swing.component.custom.WorkspaceContainerBeanInfo.isBean(WorkspaceContainerBeanInfo.java:191)
at com.swtdesigner.model.swing.component.custom.WorkspaceContainerBeanInfo.fetchDefaultValuesForPropertyDescriptors(WorkspaceContainerBeanInfo.java:181)
at com.swtdesigner.model.swing.JavaBeanInfo.initClassAndBounds(JavaBeanInfo.java:635)
at com.swtdesigner.model.swing.JavaBeanInfo.<init>(JavaBeanInfo.java:160)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.<init>(ComponentBeanInfo.java:106)
at com.swtdesigner.model.swing.component.ContainerBeanInfo.<init>(ContainerBeanInfo.java:97)
at com.swtdesigner.model.swing.component.custom.ContainerBeanWithPropertyChildrenInfo.<init>(ContainerBeanWithPropertyChildrenInfo.java:51)
at com.swtdesigner.model.swing.component.custom.WorkspaceContainerBeanInfo.<init>(WorkspaceContainerBeanInfo.java:51)
at com.swtdesigner.gef.tools.swing.SwingBeanCreationToolEntry$1.getNewObject(SwingBeanCreationToolEntry.java:114)
at org.eclipse.gef.requests.CreateRequest.getNewObject(CreateRequest.java:72)
at com.swtdesigner.gef.policy.swing.layout.border.BorderLayoutEditPolicy.getCreateCommand(BorderLayoutEditPolicy.java:211)
at org.eclipse.gef.editpolicies.LayoutEditPolicy.getCommand(LayoutEditPolicy.java:175)
at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:494)
at org.eclipse.gef.tools.TargetingTool.getCommand(TargetingTool.java:111)
at org.eclipse.gef.tools.CreationTool.handleMove(CreationTool.java:183)
at org.eclipse.gef.tools.AbstractTool.mouseMove(AbstractTool.java:992)
at org.eclipse.gef.EditDomain.mouseMove(EditDomain.java:221)
at com.swtdesigner.gef.DesignerEditDomain.mouseMove(DesignerEditDomain.java:206)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseMoved(DomainEventDispatcher.java:331)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove(LightweightSystem.java:506)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:144)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2908)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1612)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1578)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:333)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:268)
at org.eclipse.core.launcher.Main.basicRun(Main.java:260)
at org.eclipse.core.launcher.Main.run(Main.java:887)
at org.eclipse.core.launcher.Main.main(Main.java:871)
Caused by: java.lang.NullPointerException
at edu.virginia.speclab.juxta.diff.viewer.CollationViewer.highlightDifferences(CollationViewer.java:75)
at edu.virginia.speclab.juxta.diff.viewer.CollationViewer.<init>(CollationViewer.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.swtdesigner.model.swing.component.custom.ContainerBeanWithPropertyChildrenInfo$1.run(ContainerBeanWithPropertyChildrenInfo.java:300)
NickL
 

Re: more info

Postby Eric Clayberg » Sat Mar 26, 2005 7:18 pm

NickL wrote:Ok, here's the error that appears in the log when I perform the sequence I described earlier

The error indicates that it can't instantiate your custom widget for some reason.

If you want to send us the class, we can try it on our end.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: Google [Bot] and 1 guest