unable to use designer with main method

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 use designer with main method

Postby LORDs_diakonos » Fri May 27, 2005 8:29 am

I have a main Class see below that creates the gui with my main pane and menu but the designer throw an error if I try to open it wit hthe designer. I have pasted the error below along with the code. Thank you

eclipse.buildId=I20050513-1415
java.version=1.5.0_03
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86
I am also use the latest verion of the designer for m7 I downlaoded it the other day.

Code: Select all
package org.nmi.iris.ui;

import java.awt.*;
import javax.swing.*;

public class IRIS
{
   public static void main(String[] args)
   {
      javax.swing.SwingUtilities.invokeLater(
         new Runnable(){
            public void run(){createAndShowGUI();}
         }
      );
   }

   private static void createAndShowGUI()
   {
      try
      {
//         UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
//         UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
         JFrame.setDefaultLookAndFeelDecorated(true);
   
         // Create and initialize JFrame
         JFrame mainFrame = new JFrame("IRIS");
         mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container contentPane = mainFrame.getContentPane();
   
         mainFrame.setContentPane(new MainPane());
         mainFrame.setJMenuBar(new MenuBar());
   
         // Display JFrame
         mainFrame.pack();
         mainFrame.setVisible(true);
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
}


com.swtdesigner.properties.PropertyException: java.lang.reflect.InvocationTargetException
at com.swtdesigner.model.swing.component.ComponentBeanInfo.createShot(ComponentBeanInfo.java:905)
at com.swtdesigner.model.swing.component.ContainerBeanInfo.createShot(ContainerBeanInfo.java:537)
at com.swtdesigner.model.swing.component.tab.JTabbedPaneInfo.createShot(JTabbedPaneInfo.java:203)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.createChildrenShots(ComponentBeanInfo.java:956)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.createShot(ComponentBeanInfo.java:907)
at com.swtdesigner.model.swing.component.ContainerBeanInfo.createShot(ContainerBeanInfo.java:537)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5589)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5567)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.handleRootNodeSelected(DesignerEditorPropertyComposite.java:529)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.updatePropertyComposite(DesignerEditorPropertyComposite.java:709)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:837)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:741)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:707)
at com.swtdesigner.editors.MultiPageEditor.showDesignEditor(MultiPageEditor.java:306)
at com.swtdesigner.editors.MultiPageEditor$2.widgetSelected(MultiPageEditor.java:156)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1036)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:891)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3137)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1921)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2770)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2475)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1601)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1565)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:315)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:230)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:371)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:160)
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:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:330)
at org.eclipse.core.launcher.Main.basicRun(Main.java:274)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:851)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.createShot(ComponentBeanInfo.java:853)
... 43 more
Caused by: java.lang.Error: Source component not connected to component tree hierarchy
at javax.swing.SwingUtilities.convertPoint(SwingUtilities.java:116)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.convertComponentLocationToModel(ComponentBeanInfo.java:961)
at com.swtdesigner.model.swing.component.ComponentBeanInfo$2.run(ComponentBeanInfo.java:845)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

java.lang.reflect.InvocationTargetException
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:585)
at com.swtdesigner.model.swing.component.custom.ContainerBeanWithPropertyChildrenInfo.createChildAccessedBy(ContainerBeanWithPropertyChildrenInfo.java:457)
at com.swtdesigner.model.swing.JavaBeanInfo.getChildAccessedBy(JavaBeanInfo.java:286)
at com.swtdesigner.model.swing.component.custom.ContainerBeanWithPropertyChildrenInfo.createPropertyBasedChildren(ContainerBeanWithPropertyChildrenInfo.java:282)
at com.swtdesigner.model.swing.component.custom.ContainerBeanWithPropertyChildrenInfo.treeBuildingComplete(ContainerBeanWithPropertyChildrenInfo.java:94)
at com.swtdesigner.model.JavaInfo.doAcceptAsRoot(JavaInfo.java:903)
at com.swtdesigner.model.swing.component.ContainerBeanInfo.doAcceptAsRoot(ContainerBeanInfo.java:600)
at com.swtdesigner.model.parser.JavaInfoParser.getRootNodes(JavaInfoParser.java:398)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:807)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:741)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:707)
at com.swtdesigner.editors.MultiPageEditor.showDesignEditor(MultiPageEditor.java:306)
at com.swtdesigner.editors.MultiPageEditor$2.widgetSelected(MultiPageEditor.java:156)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1036)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:891)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3137)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1921)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2770)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2475)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1601)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1565)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:315)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:230)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:371)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:160)
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:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:330)
at org.eclipse.core.launcher.Main.basicRun(Main.java:274)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.Error: getHelpMenu() not yet implemented.
at javax.swing.JMenuBar.getHelpMenu(JMenuBar.java:218)
... 45 more
LORDs_diakonos
 

Re: unable to use designer with main method

Postby Eric Clayberg » Sun May 29, 2005 4:43 am

LORDs_diakonos wrote:I have a main Class see below that creates the gui with my main pane and menu but the designer throw an error if I try to open it wit hthe designer. I have pasted the error below along with the code.

Can you e-mail us a complete test case? The code you provided would not compile as-is due to the missing pieces.
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

Postby LORDs_diakonos » Wed Jun 01, 2005 8:18 am

I emailed you our code. Any headway yet?
LORDs_diakonos
 

Postby Eric Clayberg » Fri Jun 03, 2005 6:11 am

LORDs_diakonos wrote:I emailed you our code. Any headway yet?

Yes. It took awhile as the code you sent was not complete (several necessary classes would not compile due to missing references).

The latest v4.0.1 build will handle this code better. It appears to have been written by hand or some tool other than Designer, so there are some limitation on how much we can do with it.

You do need to either comment out the line...

Code: Select all
//Container contentPane = mainFrame.getContentPane();

...or hide it...
Code: Select all
Container contentPane = mainFrame.getContentPane(); //$hide$

That line doesn't seem to do anything in any case, and the multiple content panes defined (this line plus the following setContentPane() line) cause problems for the Designer parser.
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