Your loops are doing the exact same thing just in a different order.
In both loops, for each row i you are inserting the value i * 1000.
So in both columns row 0 will contain 0, 1 will contain 1000, 2 will
contain 2000, etc.
The following code will do what you want:
Grid theGrid = new Grid(10, 2);
for (int i = 9; i >= 0; i--) {
theGrid.setText(i, 0, "" + (9 - i) * 1000);
theGrid.setText(i, 1, "" + i * 1000);
}
Hope this helps!
On May 8, 5:12 am, Jens <[email protected]> wrote:
> Hi, here's my code snippet. Creates a fairly simple grid.
>
> Grid theGrid = new Grid(10, 2);
>
> for (int i = 9; i >= 0; i--) {
> theGrid.setText(i, 0, ""+i*1000);
> }
> for (int i = 0; i <= 9; i++) {
> theGrid.setText(i, 1, ""+i*1000);
> }
>
> What I am expecting is to see a grid with two columns and 10 rows.
> In col 1 there should be the numbers from 9000 to 0 printed printed in
> the corresponding row adressed by i.
> In col 2 there should be the numbers from 0 to 9000 printed in the
> corresponding row adressed by i.
>
> Instead, in both cols the numbers from 0 to 9000 are printed.....what
> am i doing wrong here?
>
> Help appreciated!
>
> TIA,
> Jens
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---