gpt4 book ai didi

java - 如何使用 GWT-Graphics 绘制 "text"

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:19:46 25 4
gpt4 key购买 nike

我正在使用 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)

对此的任何输入都会有很大帮助。

谢谢。

最佳答案

这个问题应该在最新版本的 GWT Graphics 中得到修复。从 here 下载此版本 0.9.3 .

关于java - 如何使用 GWT-Graphics 绘制 "text",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2241982/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com