Thank you, Gregor.

The problem is resolved by adding two lines as indicated below:

        Label usernameLabel = new Label("Username");
        Label passwordLabel = new Label("Password");
        username = new TextBox();
        password = new PasswordTextBox();
   >> password.setWidth("100%");
        Grid grid = new Grid(2, 2);
   >> grid.getColumnFormatter().setWidth(1, "100%");
        grid.setWidget(0, 0, usernameLabel);
        grid.setWidget(1, 0, passwordLabel);
        grid.setWidget(0, 1, username);
        grid.setWidget(1, 1, password);


On Thu, Dec 18, 2008 at 1:19 AM, gregor <[email protected]>wrote:

>
> Look up HTMLTable.ColumnFormatter (Grid's superclass) in javadoc - you
> should be able to do what you need with that.
>
> On Dec 17, 3:52 pm, hezjing <[email protected]> wrote:
> > Hi
> >
> > I have the following code to display input field for username and
> password:
> >
> >         Label usernameLabel = new Label("Username");
> >         Label passwordLabel = new Label("Password");
> >         username = new TextBox();
> >         password = new PasswordTextBox();
> >         Grid grid = new Grid(2, 2);
> >         grid.setWidget(0, 0, usernameLabel);
> >         grid.setWidget(1, 0, passwordLabel);
> >         grid.setWidget(0, 1, username);
> >         // the width of password is somewhat shorter than username
> >         grid.setWidget(1, 1, password);
> >
> > When tested in GWT 1.5.3 hosted mode, the width of the password is
> smaller
> > than the width of username.
> > I'm expecting the width of the widgets in the same column are the same,
> yes?
> >
> > I tried password.setWidth("100%"), but it doesn't change the width too!
> > How to make the width of username and password the same?
> >
> > --
> >
> > Hez
> >
>


-- 

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