10 Oct

Tutorial Java ME 2 – Part 6 TextField

Contoh Penggunaan TextField pada Form Java ME – J2ME

public class TextFieldDemo extends Form {

    public TextFieldDemo() {
        super("TextField Demo");
        
        TextField tf1 = new TextField("ANY", "", 100, TextField.ANY);
        TextField tf2 = new TextField("DECIMAL", "", 100, TextField.DECIMAL);
        TextField tf3 = new TextField("EMAIL", "", 100, TextField.EMAILADDR);
        TextField tf4 = new TextField("NUMERIC", "", 100, TextField.NUMERIC);
        TextField tf5 = new TextField("PHONE", "", 100, TextField.PHONENUMBER);
        TextField tf6 = new TextField("DISABLE", "xxx", 100, TextField.UNEDITABLE);
        TextField tf7 = new TextField("URL", "", 100, TextField.URL);
        
        append(tf1);
        append(tf2);
        append(tf3);
        append(tf4);
        append(tf5);
        append(tf6);
        append(tf7);
    }
    
}

Leave a Reply

Your email address will not be published. Required fields are marked *