I am trying to implement array of Horizontal panels in GWT as follows:
HorizontalPanel[] hp = new HorizontalPanel[5];
VerticalPanel vp = new VerticalPanel();
for(i=0;i<5;i++) {
hp[i].add(new Label("hello"));
vp.add(hp[i]);
}
but it gives NullPointerException in 1st line of loop .
Where am i wrong ?
How to implement this in GWT ?
Initializing an array doesn’t initialize the elements of the array. To go this route you need to do this: