Gwt-textbox-widget
GWT-TextBoxウィジェット
前書き
クラス宣言
以下は com.google.gwt.user.client.ui.TextBox クラスの宣言です-
CSSスタイルルール
次のデフォルトのCSSスタイルルールがすべてのTextBoxウィジェットに適用されます。 要件に応じて上書きできます。
クラスコンストラクター
Sr.No. | Constructor & Description |
---|---|
1 |
TextBox() 空のテキストボックスを作成します。 |
2 |
TextBox(Element element) このコンストラクタは、既存の要素を明示的に使用するためにサブクラスによって使用される場合があります。 |
クラスメソッド
Sr.No. | Function name & Description |
---|---|
1 |
HasDirection.Direction getDirection() ウィジェットの方向性を取得します。 |
2 |
int getMaxLength() テキストボックスの最大許容長を取得します。 |
3 |
int getVisibleLength() テキストボックスに表示される文字の数を取得します。 |
4 |
void setDirection(HasDirection.Direction direction) ウィジェットの方向性を設定します。 |
5 |
void setMaxLength(int length) テキストボックスの最大許容長を設定します。 |
6 |
void setVisibleLength(int length) テキストボックスに表示される文字の数を設定します。 |
7 |
static TextBox wrap(Element element) 既存の<input type = 'text'>要素をラップするTextBoxウィジェットを作成します。 |
継承されるメソッド
このクラスは、次のクラスからメソッドを継承します-
- com.google.gwt.user.client.ui.UIObject
- com.google.gwt.user.client.ui.Widget
- com.google.gwt.user.client.ui.FocusWidget
- com.google.gwt.user.client.ui.TextBoxBase
- java.lang.Object
TextBoxウィジェットの例
この例では、GWTでTextBoxウィジェットの使用方法を示す簡単な手順を紹介します。 次の手順に従って、_GWTで作成したGWTアプリケーションを更新します-アプリケーションの作成_の章-
Step | Description |
---|---|
1 | Create a project with a name HelloWorld under a package com.finddevguides as explained in the GWT - Create Application chapter. |
2 | Modify HelloWorld.gwt.xml, HelloWorld.css, HelloWorldl and HelloWorld.java as explained below. Keep rest of the files unchanged. |
3 | Compile and run the application to verify the result of the implemented logic. |
以下は、変更されたモジュール記述子 src/com.finddevguides/HelloWorld.gwt.xml の内容です。
以下は、変更されたスタイルシートファイル war/HelloWorld.css の内容です。
以下は、変更されたHTMLホストファイル war/HelloWorldl の内容です。
TextBoxウィジェットの使用方法を示すJavaファイル src/com.finddevguides/HelloWorld.java の内容を見てみましょう。
すべての変更が完了したら、link:/gwt/gwt_create_application [GWT-アプリケーションの作成]の章で行ったように、アプリケーションをコンパイルして開発モードで実行します。 すべてがあなたのアプリケーションでうまくいけば、これは次の結果を生成します-