Friday, July 1, 2011

GWT Designer does not allow me to add custom component.

So, I developed a simple custom component consisting of a panel, two
buttons, a text field, and a text area. I want to be able to embed
this component in my main window. However, when I attempt to add the
component into the main window of my program using the GWT palette, I
receive the error message shown below. In addition, as I hover the
mouse, a small hovertext box appears reading "Exception during live
image creation. See error log for details." I have a copy of the
zipped report file if there is any place that I can post it, as well:

Internal Error
GWT Designer encountered unexpected internal error.

This could be caused by a GWT Designer bug or by a misconfiguration
issue, conflict, partial update, etc.

Stack trace:
java.lang.NullPointerException
at
org.eclipse.wb.internal.swing.java6.model.SwingVisualMapper.getComponentPreferredSize(SwingVisualMapper.java:
85)
at
org.netbeans.modules.form.layoutdesign.LayoutDesigner.endMoving(LayoutDesigner.java:
596)
at
org.eclipse.wb.internal.layout.group.model.GroupLayoutSupport.command_create(GroupLayoutSupport.java:
276)
at
org.eclipse.wb.internal.layout.group.gef.GroupLayoutEditPolicy2$4.executeEdit(GroupLayoutEditPolicy2.java:
510)
at org.eclipse.wb.core.gef.command.EditCommand$1.run(EditCommand.java:
52)
at
org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.run(ExecutionUtils.java:
318)
at
org.eclipse.wb.core.gef.command.EditCommand.execute(EditCommand.java:
50)
at
org.eclipse.wb.internal.gef.core.EditDomain.executeCommand(EditDomain.java:
59)
at org.eclipse.wb.gef.core.tools.Tool.executeCommand(Tool.java:209)
at
org.eclipse.wb.gef.core.tools.AbstractCreationTool.handleButtonUp(AbstractCreationTool.java:
62)
at org.eclipse.wb.gef.core.tools.Tool.mouseUp(Tool.java:395)
at
org.eclipse.wb.internal.gef.core.EditDomain.mouseUp(EditDomain.java:
255)
at
org.eclipse.wb.internal.gef.graphical.EditEventManager.mouseUp(EditEventManager.java:
149)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.wb.internal.draw2d.EventManager
$8.invoke(EventManager.java:325)
at $Proxy5.mouseUp(Unknown Source)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
213)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:
4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:
2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:
332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:
149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:
115)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:
196)
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:
369)
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:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

The code for my custom component is:
<code>package com.charybdis.gui;

import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.border.LineBorder;
import java.awt.Color;

public class AddableSection extends JPanel {
/**
* Create the panel.
*/
public AddableSection()
{
super();
initialize();
}

private void initialize()
{
setBorder(new LineBorder(null, 1, true));

JTextArea textArea = new JTextArea();
textArea.setBorder(new LineBorder(new Color(0, 0, 0)));
textArea.setRows(10);

JButton button = new JButton("- Section");
button.setEnabled(false);

JButton button_1 = new JButton("+ Section");

JTextPane textPane = new JTextPane();
textPane.setBorder(new LineBorder(new Color(0, 0, 0)));
textPane.setText("Section Title");
textPane.setFont(new Font("Tahoma", Font.PLAIN, 16));
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(textArea, GroupLayout.DEFAULT_SIZE, 478,
Short.MAX_VALUE)
.addGroup(Alignment.TRAILING,
groupLayout.createSequentialGroup()
.addComponent(textPane, GroupLayout.PREFERRED_SIZE, 286,
GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 79,
GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 75,
GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 26,
GroupLayout.PREFERRED_SIZE)
.addComponent(button_1))
.addComponent(textPane, GroupLayout.PREFERRED_SIZE, 22,
GroupLayout.PREFERRED_SIZE))
.addGap(11)
.addComponent(textArea, GroupLayout.DEFAULT_SIZE, 198,
Short.MAX_VALUE)
.addContainerGap())
);
setLayout(groupLayout);
}
}</code>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment