How to draw "text" using GWT-Graphics
I am using GWT-Graphics to create shapes like rectangle, circles etc... Now i am trying to add text to these shapes. Here is how the code looks like:
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 );
But when i run the program i am getting the following Error:
[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.fi开发者_运维百科reNativeEvent(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)
Any input on this will be of great help.
Thank you.
This issue should be fixed in the newest version of GWT Graphics. Download this version, 0.9.3, from here.
精彩评论