Try doing an initialization first:
       for (int i = 0; i < gamePlan.getColumnCount(); i++)
                                       for (int j = 0; j <
gamePlan.getRowCount(); j++)

 gamePlan.setWidget(i,j, new Image());

Then in your actual paint do:
imagePrototype.applyTo(gamePlan.getWidget(i, j))


On Thu, Mar 19, 2009 at 6:30 PM, GhostNr1 <[email protected]> wrote:

>
> Hi!
>
> I'm trying to use ImageBundle to paint all my images. That's work very
> good except from one thing.
>
> Every 3 secound I poll the server to check if an ohtello plan have
> changed and then I try to paint it
>
>                                for (int i = 0; i <
> gamePlan.getColumnCount(); i++) {
>                                        for (int j = 0; j <
> gamePlan.getRowCount(); j++) {
>                                                if
> (result.getGamePlan()[i][j].equals("B")) {
>
>  gamePlan.setWidget(i,j, blackImgPrototype.createImage());
>                                                } else if
> (result.getGamePlan()[i][j].equals("W")) {
>
>  gamePlan.setWidget(i,j, whiteImgPrototype.createImage());
>                                                } else {
>
>  gamePlan.setWidget(i,j, greenImgPrototype.createImage());
>                                                }
>                                        }
>                                }
>
> I use that one, the problem is I use blackImgPrototype.createImage()
> so it create 64 new images every 3:rd secound and the memory stall.
> Any suggestion how I can fix this.
>
>                                Image black =
> blackImgPrototype.createImage();
>                                Image white =
> whiteImgPrototype.createImage();
>                                Image green =
> greenImgPrototype.createImage();
>                                for (int i = 0; i <
> gamePlan.getColumnCount(); i++) {
>                                        for (int j = 0; j <
> gamePlan.getRowCount(); j++) {
>                                                if
> (result.getGamePlan()[i][j].equals("B")) {
>
>  gamePlan.setWidget(i,j, black);
>                                                } else if
> (result.getGamePlan()[i][j].equals("W")) {
>
>  gamePlan.setWidget(i,j, white);
>                                                } else {
>
>  gamePlan.setWidget(i,j, green);
>                                                }
>                                        }
>                                }
>
> I have tryed that but then it only paint one black one white and one
> green image.
>
> Thx for help
> >
>

--~--~---------~--~----~------------~-------~--~----~
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