how add custom component to a form

hi,
i have a class with name:

public class ProductForm extends Form

and i use setItemDataSource to generate form.

i have a property with name: “createDate” with Date type.

now, i want use customize date (3 combo for day , month, year) and i wan’t use vaadin date field.
I guess i must create a class that extend CustomComponent and then my ProductForm use that as below:

public class JalaliDate extends CustomComponent {
NativeSelect day = new NativeSelect();
NativeSelect month = new NativeSelect();
NativeSelect year = new NativeSelect();
HorizontalLayout datePack = new HorizontalLayout();

public JalaliDate() {
    Date date = new Date();
    com.ibm.icu.util.Calendar pcal = new com.YeCC.util.icu.PersianCalendar();
    pcal.setTime(date);
    final int pCurYear = pcal.get(com.ibm.icu.util.Calendar.YEAR);

    for (int i = 1; i <= 31; i++) {
        day.addItem(i);
    }
    for (int i = 1; i <= 12; i++) {
        month.addItem(i);
    }
    for (int i = pCurYear - 50; i <= pCurYear ; i++) {
        year.addItem(i);
    }
    datePack.addComponent(year);
    datePack.addComponent(month);
    datePack.addComponent(day);
    datePack.addComponent(new Label(LanguageUtil.get(locale,"aacreateDate")));
    setCompositionRoot(datePack);
}

}


        public Field createField(Item item, Object o, Component component) {
            Field field = super.createField(item, o, component);



if(o.equals(“createDate”)){
jalaliDate = new JalaliDate();
return (Field)jalaliDate;
}
}

but this has error for cast (i guess this will be error)

please help me how i use custom date fields instead of vaadin date

The CustomComponent does not implement the Field interface. The easiest way to get that is to use the
CustomField
add-on.

See
an example
.

tanks for response
but i don’t know how use my class that extend CustomField in createField method