如何使用GWT-Graphics绘制“文本”

时间:2010-02-11 03:05:13

标签: java graphics gwt

我正在使用GWT-Graphics来创建像矩形,圆形等形状......现在我正在尝试为这些形状添加文字。代码如下所示:

DrawingArea d1 = new DrawingArea(100, 100);
Ellipse e = new Ellipse(29, 20, 30, 20);
Text t = new Text(10, 20, "A");
d1.add(e);
d1.add(t);
boundaryPanel.add(d1, 200, 40 );

但是当我运行程序时,我收到以下错误:

[ERROR] Uncaught exception escaped
java.lang.AssertionError: The style name 'v-text-align' should be in camelCase format
    at com.google.gwt.dom.client.Style$.assertCamelCase$(Style.java:63)
    at com.google.gwt.dom.client.Style$.setProperty$(Style.java:42)
    at com.vaadin.contrib.gwtgraphics.client.impl.VMLImpl.createElement(VMLImpl.java:101)
    at com.vaadin.contrib.gwtgraphics.client.VectorObject.<init>(VectorObject.java:37)
    at com.vaadin.contrib.gwtgraphics.client.Shape.<init>(Shape.java:27)
    at com.vaadin.contrib.gwtgraphics.client.shape.Text.<init>(Text.java:25)
    at com.e.r.d.client.ERD1$2.onClick(ERD1.java:74)
    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)
    at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
    at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
    at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
    at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
    at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
    at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:264)
    at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:557)
    at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
    at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)

对此的任何意见都会有很大的帮助。

谢谢。

1 个答案:

答案 0 :(得分:1)

此问题应在最新版本的GWT Graphics中修复。从here下载此版本0.9.3。