FormLayout Problem


I am trying to build a form. Everything works if i use a VerticalLayout in Form constructor

Form frm = new Form(new VerticalLayout)

but with this layout textfield labels are shown above the Textfield and i don’t want that.
I want the the labels to appear on the left side.

When i use the default constructor of the Form or if i use FormLayout

Form frm = new Form()
Form frm = new Form(new FormLayout)

when my form is not visible and i get in vaadin debug console this error “ClassCastException: null”
also it tells me “com.vaadin.ui.FormLayout(NO CLIENT IMPLEMENTATION FOUND)”

any help please?

Thank you in advance.


You can try something like that:

Form form = new Form();
GridLayout grid = new Grid(2, 2);
form.setItemDataSource( /* your data source - for example BeanItem */ );

//from Form
protected void attachField(Object propertyId, Field field) {
        if (propertyId.equals(UserBean.Label_1)) {
            layout.addComponent(new Label("left Label"), 1, 0);
        } else if (propertyId.equals(UserBean.Text_1)) {
            layout.addComponent(field, 1, 1);

for field-editing you should something similar to DefaultFieldFactory, creat your own or let your class extend it.

Form uses FormLayout as its default layout so you should never need to set it explicitly.

This looks like you are using the wrong widgetset version or a widgetset that was not compiled correctly.
Check that you don’t have two different Vaadin JARs on your classpath.