我在项目中使用PopupPanel和Gwt Canvas。单击画布绘图区域时,将显示弹出面板。在我的主类中,我有一个扩展PopupPanel的私有类,然后在onModuleLoad()中调用此面板。代码看起来像这样:
Button b = new Button("Circle");
b.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
DrawingArea d = new DrawingArea(40, 30);
Circle c = new Circle(20, 15, 20);
d.add(c);
dragController.makeDraggable(d);
dragController.setBehaviorDragStartSensitivity(1);
boundaryPanel.add(d, 200, 200 );
//Diagram dia = new Diagram(boundaryPanel);
/* Shape s = new Shape(d);
s.showOnDiagram(diagram);*/
d.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
System.out.println("ERD Circle");
Widget w = (Widget)event.getSource();
PopUpPanel pop = new PopUpPanel(w);
pop.setPopupPosition(w.getAbsoluteLeft() - 150, w.getAbsoluteTop());
pop.show();
}
});
}
});
这里的PopUpPanel是扩展PopupPanel的那个。这里是PopUpPanel的代码:
private static class PopUpPanel extends PopupPanel{
Button connect = new Button("Connect");
Button delete = new Button("Delete");
Button detail = new Button("Detail");
public PopUpPanel(final Widget widget){
super(true);
VerticalPanel vp = new VerticalPanel();
vp.add(connect);
vp.add(delete);
vp.add(detail);
setWidget(vp);
}
}
现在我面临的问题是:
当我单击画布绘图区域时,PopupPanel出现错误。错误详细信息如下:
[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (Error): Invalid class string
number: -2147221005
description: Invalid class string
at com.google.gwt.user.client.ui.impl.PopupImplIE6.onShow(Native Method)
at com.google.gwt.user.client.ui.PopupPanel$ResizeAnimation.onInstantaneousRun(PopupPanel.java:257)
at com.google.gwt.user.client.ui.PopupPanel$ResizeAnimation.setState(PopupPanel.java:180)
at com.google.gwt.user.client.ui.PopupPanel.setState(PopupPanel.java:1189)
at com.google.gwt.user.client.ui.PopupPanel.show(PopupPanel.java:794)
at com.e.r.d.client.ERD1$4$1.onClick(ERD1.java:177)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:52)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:90)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)
任何输入都会有很大帮助。
谢谢。
最佳答案
我知道了发生这种情况是由于缺少Microsoft JScript注册。一旦我注册了“ regsvr32 jscript.dll”,它就可以正常工作。谢谢。