Sunday, May 10, 2009

IndexOutOfBoundsException: Column index: 1, Column size: 1

java.lang.IndexOutOfBoundsException: Column index: 1, Column size: 1
    at com.google.gwt.user.client.ui.Grid.prepareCell(Grid.java:258)

 

So, apparently, this is the error you get when you try to add a widget to a cell in a Grid that does not exist. Serves me right!

 

Changing the Grid to 5,2 instead of 5,1 worked. I guest the method setWidget is zero based, but the Grid constructor in ordinal.

 

final VerticalPanel panel = new VerticalPanel();

        final Grid grid = new Grid(5, 2);
        initWidget(grid);

        grid.setWidget(0, 0, new Label("Query"));
        TextArea queryTextArea = new TextArea();

        queryTextArea.setWidth("1000px");
        queryTextArea.setHeight("200");
        grid.setWidget(0, 1, queryTextArea);

No comments:

Post a Comment

Followers