GWT標準コンポーネント

各ウィジェットの詳細はここでは書きませんが、以下の点はマスターしましょう。

    1. GWT公式ドキュメントにあるWidget Listは一通り目を通しておくとよいです。
    2. GWT Showcase of Featureというサイトは要チェックです。ここでサンプルコードもわかります。

Imageウィジェット

URLを参照して画像を表示する

   final Image image = new Image();      // Hook up an error handler, so that we can be informed if the image fails     // to load.     image.addErrorHandler(new ErrorHandler() {       public void onError(ErrorEvent event) {         lbl.setText("An error occurred while loading.");       }     });      // Point the image at a real URL.     image.setUrl("http://www.google.com/images/logo.gif");

FlexTable

ウェブアプリケーションでは、画面レイアウトにうまくテーブルを利用するのがコツです。GWTでは、FlexTableという使いやすいテーブルのウィジェットがありますので、これを使いこなしましょう。テーブルの上には、テキストの他、ウィジェットも載せることができます。

UIBinder

<g:FlexTable>ui:field="tbl"</g:FlexTable>

Javaコード

@UiField
FlexTable tbl;
tbl.setText(0,0,"あああああ");
tbl.setText(0,1,"いいいいい");