Locked History Actions

Diff for "GWT/SVG"

Differences between revisions 8 and 9
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
lib-gwt-svgというライブラリを使う。  [[lib-gwt-svg|lib-gwt-svgへ]]
Line 7: Line 7:
 * [[http://www.vectomatic.org/lib-gwt-svg|lib-gwt-svg本家]]
 * [[http://code.google.com/p/lib-gwt-svg/|lib-gwt-svg本家ダウンロード]]
 * [[http://www.vectomatic.org/gwt/lib-gwt-svg-samples/lib-gwt-svg-samples.html|本家サンプル]]
 * [[http://d.hatena.ne.jp/H_Yamaguchi/20100714/p1|GWTでSVGを書いてみた]]
 * [[http://kissaki-blog.blogspot.com/2011/09/gwtsvg.html|GWTでSVGを書く]]
Line 13: Line 8:
上記「GWTでSVGを...」の通りにすれば簡単にできる。

GWTでSVGを使う

lib-gwt-svg

raphaelgwt

raphaelgwtというライブラリを使う。

※raphaelgwtはraphaelのラッパだが、raphaelはSVGではない。SVGを参照のこと

使い方がよくわからないが、以下のようにすればとりあえず描画ができる。

  • ライブラリをダウンロードしてパスを通す。
  • 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をパレットに登録してデザイン画面に入れる。