<hbj:formLayout id="myForm"
marginTop="15px"
marginRight="30px"
marginBottom="5px"
marginLeft="15px"
width="500px" >
<hbj:formLayoutRow id="Row1"
paddingTop="10px"
paddingBottom="5px" >
<hbj:formLayoutCell id="Cell11"
align="RIGHT"
paddingLeft="3"
paddingTop="5"
paddingRight="10"
paddingBottom="5"
width="40%" >
<hbj:button id="myButtonf11" text="Button" />
</hbj:formLayoutCell>
<hbj:formLayoutCell id="Cell12"
align="LEFT"
paddingLeft="3"
paddingTop="5"
paddingRight="10"
paddingBottom="5" >
<hbj:textView text="Celltext aligned left" />
</hbj:formLayoutCell>
</hbj:formLayoutRow>
<hbj:formLayoutRow id="Row2"
paddingTop="10px"
paddingBottom="5px" >
<hbj:formLayoutCell id="Cell21"
align="LEFT"
paddingLeft="3"
paddingTop="5"
paddingRight="10"
paddingBottom="5" >
<hbj:button id="myButtonf21" text="Button" />
</hbj:formLayoutCell>
<hbj:formLayoutCell id="Cell22"
align="RIGHT"
paddingLeft="3"
paddingTop="5"
paddingRight="10"
paddingBottom="5" >
<hbj:textView encode="false" text="Celltext aligned right" />
</hbj:formLayoutCell>
</hbj:formLayoutRow>
</hbj:formLayout>
Form form = (Form)this.getForm();
FormLayout fl = new FormLayout();
fl.setId("myForm");
fl.setMarginTop("15px");
fl.setMarginRight("30px");
fl.setMarginBottom("5px");
fl.setMarginLeft("15px");
fl.setWidth("500px");
fl.setDebugMode(true);
FormLayoutRow row1 = fl.addRow();
row1.setPaddingTop("10px");
row1.setPaddingBottom("5px");
Button button = new Button("button", "button");
FormLayoutCell cell11 = fl.addComponent(1,1, button);
cell11.setHorizontalAlignment(CellHAlign.RIGHT);
cell11.setPaddingLeft("3");
cell11.setPaddingTop("5");
cell11.setPaddingRight("10");
cell11.setPaddingBottom("5");
cell11.setWidth("40%");
TextView tv1 = new TextView("tv1");
tv1.setText("Celltext aligned left");
FormLayoutCell cell12 = fl.addComponent(1,2, tv1);
cell12.setHorizontalAlignment(CellHAlign.LEFT);
cell12.setPaddingLeft("3");
cell12.setPaddingTop("5");
cell12.setPaddingRight("10");
cell12.setPaddingBottom("5");
cell12.setWidth("40%");
FormLayoutRow row2 = fl.addRow();
row2.setPaddingTop("10px");
row2.setPaddingBottom("5px");
Button button2 = new Button("button2", "button");
FormLayoutCell cell21 = fl.addComponent(2,1, button2);
cell21.setHorizontalAlignment(CellHAlign.LEFT);
cell21.setPaddingLeft("3");
cell21.setPaddingTop("5");
cell21.setPaddingRight("10");
cell21.setPaddingBottom("5");
cell21.setWidth("40%");
TextView tv2 = new TextView("tv2");
tv2.setText("Celltext aligned right");
FormLayoutCell cell22 = fl.addComponent(2,2, tv2);
cell22.setHorizontalAlignment(CellHAlign.RIGHT);
cell22.setPaddingLeft("3");
cell22.setPaddingTop("5");
cell22.setPaddingRight("10");
cell22.setPaddingBottom("5");
cell22.setWidth("40%");
form.addComponent(fl);