I am using a FlexTable and i have more than 10 fields. I too use the
setWidget to see each of my fields.

but i dont set the style for each single field seperately.

Since your input textboxes use the same style and all your labels uses
teh same style:

you can reduce the lines to set styles for these by having a seperate
css file:

say: MyStyle.css and you can include this CSS in your
<Application>.gwt.xml as
<stylesheet src='MyStyle.css' />

and you can define the style as follows:
.gwt-Label {
         //your style for labels
}
.gwt-TextBox {
         //your style for textboxes.
}

Regards,
Satya


On Jun 18, 12:38 pm, hezjing <[email protected]> wrote:
> Hi
>
> I have been implementing the input form like the following code:
>
> Label nameLabel = new Label("Name");
>  TextBox nameTextBox = new TextBox();
>
> Label ageLabel = new Label("Age");
>  TextBox ageTextBox = new TextBox();
>
> // we have two labels and two fields, so 2x2
>  Grid grid = new Grid(2, 2);
> grid.setWidget(0, 0, nameLabel);
> grid.setWidget(0, 1, nameTextBox );
>  grid.setWidget(1, 0, ageLabel);
> grid.setWidget(1, 1, ageTextBox);
>
>  // set the style to every cell
> CellFormatter fmt = grid.getCellFormatter();
>  fmt.setStyleName(0, 0, "labelStyle");
> fmt.setStyleName(0, 1, "inputStyle");
>  fmt.setStyleName(1, 0, "labelStyle");
> fmt.setStyleName(1, 1, "inputStyle");
>
> I'm using Grid because I want the labels and fields to be aligned.
>
> The code becomes ugly when there are 10 or more fields!
>
> Can you share your experience in aligning the labels and fields (form) in
> plain GWT?
>
> --
>
> Hez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to