I want to generate code that has four buttons in a horizontal layout. The first three grouped together and the last aligned right to the layout. I have read the BOV and checked the net for clues. It should be this difficult to achieve this.
HorizontalLayout buttonLayout = new HorizontalLayout();
Button button1 = new Button("Button 1");
Button button2 = new Button("Button 2");
Button button3 = new Button("Button 3");
Button button4 = new Button("Button 4");
buttonLayout.addComponent(button1);
buttonLayout.addComponent(button2);
buttonLayout.addComponent(button3);
buttonLayout.setWidth("100%");
buttonLayout.setMargin(true);
buttonLayout.setSpacing(true);
buttonLayout.addComponent(button4);
buttonLayout.setComponentAlignment(button4, Alignment.MIDDLE_RIGHT);
buttonLayout.setExpandRatio(button4, 1);
The screen shot is what I get. I have changed the label of the buttons in the code snippet.