Combobox and its label on two rows

When we create a combobox this way:

ComboBox combo1 = new ComboBox("Test");
		combo1.addItem("Item1");
		combo1.addItem("Item2");
		combo1.removeAllItems();
		combo1.addItem("Item3");
		combo1.addItem("Item4");

It needs two rows on a web page. On the first row there is “Test” and the second row we have combo1.

Question:
How the label and combo can be on the same line?

Tapani

The layout you’re adding the combobox to will decide how to present the caption, and in most cases, it’ll be on top of the component. You can’t change that easily.

Your options are either to use FormLayout, which will present the caption on the left side, or to use a separate Label component and a HorizontalLayout to show the caption.

One solution would be to use
FormLayout
which displays captions on the left side. Another would be to use a separate Label for the caption, and put the Label and the ComboBox in a HorizontalLayout

I tried FormLayout. It is god. Thanks.