TextTest.java



import com.nttdocomo.ui.*;
public class TextTest extends IApplication {

    public Panel panel;
    public Label[] labels;
    public TextBox[] boxes;

    public void start() {
        panel = new Panel();
        panel.setTitle( "文字入力のテスト" );
        Display.setCurrent( panel );
       
        labels = new Label[4];
        labels[0] = new Label( "電話番号(数字)", Label.CENTER );
        labels[1] = new Label( "ユーザ名(ABC)", Label.CENTER );
        labels[2] = new Label( "パスワード(***)", Label.CENTER );
        labels[3] = new Label( "メッセージ(かな)", Label.CENTER );

        boxes = new TextBox[4];
        boxes[0] = new TextBox( "", 16, 1, TextBox.NUMBER );
        boxes[1] = new TextBox( "", 16, 1,
                    TextBox.ALPHA | TextBox.DISPLAY_ANY );
        boxes[2] = new TextBox( "", 16, 1,
                    TextBox.ALPHA | TextBox.DISPLAY_PASSWORD );
        boxes[3] = new TextBox( "", 16, 4, TextBox.KANA );

        int green = Graphics.getColorOfRGB( 0, 128, 0 );
        int white = Graphics.getColorOfRGB( 255, 255, 255 );

        for( int i=0; i<boxes.length; i++ ) {
            labels[i].setBackground( green );
            labels[i].setForeground( white );
            panel.add( labels[i] );
            panel.add( boxes[i] );
        }
    }
}