Locked History Actions

Diff for "GWT/SVG"

Differences between revisions 5 and 6
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
 * [[http://kissaki-blog.blogspot.com/2011/09/gwtsvg.html|GWTでSVGを書く]]

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をパレットに登録してデザイン画面に入れる。