Deletions are marked like this. | Additions are marked like this. |
Line 9: | Line 9: |
* [[http://www.vectomatic.org/gwt/lib-gwt-svg-samples/lib-gwt-svg-samples.html|本家サンプル]] |
GWTでSVGを使う
lib-gwt-svg
lib-gwt-svgというライブラリを使う。
上記「GWTでSVGを...」の通りにすれば簡単にできる。
raphaelgwt
raphaelgwtというライブラリを使う。
使い方がよくわからないが、以下のようにすればとりあえず描画ができる。
- ライブラリをダウンロードしてパスを通す。
gwt.xmlファイルに「 <inherits name='com.hydro4ge.raphaelgwt.RaphaelGWT' />」を記述する。
- 以下のようなJavaファイルを作成する。
package com.mycompany.project.client; import com.hydro4ge.raphaelgwt.client.Raphael; public class SampleView extends Raphael { public SampleView(int width, int height) { super(width, height); } @Override public void onLoad(){ final Circle c = this.new Circle(25, 25, 50); c.attr("cursor","pointer"); c.attr("stroke-width","3").attr("stroke-dasharray","--"); c.attr("fill", "#00BFFF"); } }
上記SampleViewをパレットに登録してデザイン画面に入れる。