GroupLayout - Unable to add JPanel to JPanel

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

GroupLayout - Unable to add JPanel to JPanel

Postby modsiw » Fri Apr 04, 2008 6:54 am

Is there a reason I should be unable to add a JPanel to a JPanel with layout = GroupLayout?

I get the following exception in the eclipse .log file when I attempt it.

Code: Select all
java.lang.IllegalStateException: Container should be created.
   at com.swtdesigner.model.swing.layouts.managers.group.GroupLayoutInfo.convertPositionsIntoConstraints(GroupLayoutInfo.java:153)
   at com.swtdesigner.model.swing.layouts.managers.LayoutManagerInfo.setLayout(LayoutManagerInfo.java:512)
   at com.swtdesigner.model.swing.layouts.managers.group.GroupLayoutInfo.setLayout(GroupLayoutInfo.java:366)
   at com.swtdesigner.model.swing.component.ContainerBeanInfo.setDefaultLayoutManagerInfo(ContainerBeanInfo.java:438)
   at com.swtdesigner.model.swing.component.ContainerBeanInfo.addToParent(ContainerBeanInfo.java:936)
   at com.swtdesigner.model.JavaInfo.addToParent(JavaInfo.java:2863)
   at com.swtdesigner.gef.command.common.AddControlCommand.execute(AddControlCommand.java:23)
   at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:107)
   at com.swtdesigner.gef.command.common.CompoundEditCommand.execute(CompoundEditCommand.java:59)
   at org.eclipse.gef.commands.CommandStack.execute(CommandStack.java:78)
   at com.swtdesigner.gef.domain.DesignerEditDomain$1.execute(DesignerEditDomain.java:54)
   at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:416)
   at org.eclipse.gef.tools.CreationTool.performCreation(CreationTool.java:198)
   at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTool.java:122)
   at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1006)
   at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:229)
   at com.swtdesigner.gef.domain.DesignerEditDomain.mouseUp(DesignerEditDomain.java:262)
   at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:346)
   at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:511)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:206)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
   at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
   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.equinox.launcher.Main.invokeFramework(Main.java:508)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
modsiw
 
Posts: 5
Joined: Fri Apr 04, 2008 6:29 am

Re: GroupLayout - Unable to add JPanel to JPanel

Postby Eric Clayberg » Fri Apr 04, 2008 9:22 am

modsiw wrote:Is there a reason I should be unable to add a JPanel to a JPanel with layout = GroupLayout?

No reason at all as it works fine on my end.

It would be helpful to see an actual example.
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

Re: GroupLayout - Unable to add JPanel to JPanel

Postby modsiw » Sat Apr 05, 2008 8:59 am

Sadly there isn't too much to show. Due to fail to create the sub-JPanel, no code is generated.

Below is an entire test class.
My eclipse preferences export.
And a screen capture of the error.

The stack trace is the same as in the OP.


Code: Select all
package com.floorsoft.floorwizard3.kiosk.forms;

import javax.swing.GroupLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.LayoutStyle;

public class test21 extends JPanel
{

  /**
   * Create the panel
   */
  public test21() {
    super();
    GroupLayout groupLayout = new GroupLayout((JComponent) this);
    groupLayout.setHorizontalGroup(
      groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGap(0, 994, Short.MAX_VALUE)
    );
    groupLayout.setVerticalGroup(
      groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGap(0, 680, Short.MAX_VALUE)
    );
    setLayout(groupLayout);
  }

}

modsiw
 
Posts: 5
Joined: Fri Apr 04, 2008 6:29 am

Re: GroupLayout - Unable to add JPanel to JPanel

Postby modsiw » Sat Apr 05, 2008 9:04 am

Preferences can not be attached due to format restrictions of the forums.

If desired, I'm more than happy to forward via email etc.
Attachments
subpanel in group layout error.jpg
subpanel in group layout error.jpg (192.87 KiB) Viewed 2709 times
modsiw
 
Posts: 5
Joined: Fri Apr 04, 2008 6:29 am

Re: GroupLayout - Unable to add JPanel to JPanel

Postby Eric Clayberg » Sat Apr 05, 2008 9:54 am

You can attach any file as long as you zip it.
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

Re: GroupLayout - Unable to add JPanel to JPanel

Postby modsiw » Sat Apr 05, 2008 10:16 am

nt
Attachments
prefs.zip
(1.01 KiB) Downloaded 156 times
modsiw
 
Posts: 5
Joined: Fri Apr 04, 2008 6:29 am

Re: GroupLayout - Unable to add JPanel to JPanel

Postby Eric Clayberg » Mon Apr 07, 2008 10:44 am

Give this another try with the latest Swing Designer build.
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: No registered users and 1 guest