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);
    }
    
}

10 Oct

Tutorial Java ME 2 – Part 4 Image Item

Contoh penggunaan ImageItem pada Form JavaME – J2ME

public class ImageItemDemo extends Form {

    public ImageItemDemo() {
        super("ImageItem Demo");
        try {
            Image img = Image.createImage("logo.png");
            
            ImageItem i1 = new ImageItem("Gambar", img, ImageItem.LAYOUT_CENTER, "");
            ImageItem i2 = new ImageItem("Gambar", img, ImageItem.LAYOUT_CENTER, "");
            
            append(i1);
            append(i2);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
}

10 Oct

Tutorial Java ME 2 – Part 2 Date Field

Contoh penggunaan DateField pada Form Java ME – J2ME

public class DateFieldDemo extends Form {

    public DateFieldDemo() {
        super("DateField Demo");
        
        DateField df1 = new DateField("DATE: ", DateField.DATE);
        DateField df2 = new DateField("TIME:", DateField.TIME);
        DateField df3 = new DateField("DATETIME:", DateField.DATE_TIME);
        
        append(df1);
        append(df2);
        append(df3);                
    }
    
}

10 Oct

Tutorial Java ME 2 – Part 1 – Choice Group

Contoh penggunaan Choice Group pada Form Java ME – J2ME

public class ChoiceGroupDemo extends Form {

    public ChoiceGroupDemo() {
        super("ChoiceGroup Demo");
        ChoiceGroup cg1 = new ChoiceGroup("EXCLUSIVE", ChoiceGroup.EXCLUSIVE);
        cg1.append("Pilihan 1", null);
        cg1.append("Pilihan 2", null);
        
        ChoiceGroup cg2 = new ChoiceGroup("MULTIPLE", ChoiceGroup.MULTIPLE);
        cg2.append("Pilihan 1", null);
        cg2.append("Pilihan 2", null);
        
        append(cg1);
        append(cg2);
    }
    
}