Vaadin 7 TabSheet

I have a programming question:
In MainView I have a TabSheet.
I want to creat a calass (view) with TextBoxes (like a form) and put an instance of that view/form in one of the sheets of the TabSheet.
How to do that. Thank you!

Did you look at the TabSheet documentation already? TabSheet | Layout Components | Framework | Vaadin 7 Docs

Is there something you tried that didn’t work?

Hello,
Thank you for your answer.

I made this:

package com.CV9V0W;

public class Predl_list extends HorizontalLayout {
public static final String NAME = “Predl_list”;
public Predl_list() {
HorizontalLayout viewLayout = new HorizontalLayout();
viewLayout.setSpacing(true);
viewLayout.setMargin(true);
TextField Ime = new TextField(“ABC”);
viewLayout.addComponent(Ime);
}
}

and put it in the main class:

package com.CV9V0W;

public class MainView extends CustomComponent implements View {
public static final String NAME = “Main”;
public MainView() {
TabSheet Tabsheet1 = new TabSheet();
HorizontalLayout Tabsheet1_Layout1 = new Predl_list();
HorizontalLayout Tabsheet1_Layout2 = new HorizontalLayout();
Tabsheet1.addTab(Tabsheet1_Layout1, “List1”);
Tabsheet1.addTab(Tabsheet1_Layout2, “List2”);
Tabsheet1.setWidth(1245, UNITS_PIXELS);
Tabsheet1.setHeight(500, UNITS_PIXELS);
VerticalLayout viewLayout = new VerticalLayout(Tabsheet1);
viewLayout.setSpacing(true);
viewLayout.setMargin(true);
setCompositionRoot(viewLayout);

}
}

BUT nothing shows.

Your Predl_list() constructor creates a new HorizontalLayout instance and adds a TextField inside it, but it never adds the HorizontalLayout viewLayout anywhere. Maybe you want to call addComponent from the Predl_list class instead.

I think it should put it in the TabSheet:

HorizontalLayout Tabsheet1_Layout1 = new Predl_list();
Tabsheet1.addTab(Tabsheet1_Layout1, “List1”);

Am I wrong ?

That’s not wrong, but I mean this part:

public Predl_list() {
HorizontalLayout viewLayout = new HorizontalLayout();
viewLayout.setSpacing(true);
viewLayout.setMargin(true);
TextField Ime = new TextField(“ABC”);
viewLayout.addComponent(Ime); // viewLayout is not added anywhere
}

so either add this before the last line:

addComponent(viewLayout)

or get rid of the viewLayout entirely and add the TextField to the current object.

Right now, you’re just adding two empty HorizontalLayouts to the TabSheet.

With these corrections it works now.
Thank you very much Olli !

Hello again, I tried to make TabSheets look smarter. I put on them “ValoTheme”, but nothing changed. What would be the reason?

Tabsheet1.addStyleName(ValoTheme.TABSHEET_FRAMED);
Tabsheet1.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);

Maybe you are using/extending a different Theme than Valo in your application? Reindeer was quite common before Valo was introduced.