Sure :

public static void placerImage(final String urlImage, final
ClickablePanel cPanel) {

                final Image img = new Image(urlImage.toString());
                cPanel.add(img, 0, 0);
                // Resizing after load
                img.addLoadHandler(new LoadHandler() {
                        @Override
                        public void onLoad(final LoadEvent event) {
                                // Remove image
                                cPanel.remove(img);

                                // Smaller image
                                final float rapport = 2;
                                final int x = (int) (img.getWidth() / rapport);
                                final int y = (int) (img.getHeight() / rapport);

                                if (x > 0 && y > 0) {
                                        img.setPixelSize(x, y);
                                }

                                // Center image on the panel
                                int left;
                                int top;
                                int tmp = 
ConstController.getConstants().casePxSize() -
img.getWidth();
                                if (tmp > 1) {
                                        left = tmp / 2;
                                } else {
                                        left = 0;
                                }
                                tmp = 
ConstController.getConstants().casePxSize() - img.getHeight
();
                                if (tmp > 1) {
                                        top = tmp / 2;
                                } else {
                                        top = 0;
                                }

                                // add image resized
                                cPanel.add(img, left, top);
                        }
                });
        }


ClickablePanel is an AbsolutePanel with a mouseDownHandler.



On 1 sep, 21:20, monk3y <[email protected]> wrote:
> Could you post some code?
>
> On Aug 31, 1:53 pm, guymage <[email protected]> wrote:
>
> > Hi,
>
> > Here is my problem:
>
> > My program load an image, I modify the size of this image when it's
> > loaded (LoadHandler). The first time I load the image, everything
> > works fine.
> > After an action, I have to refresh the panel and the image is reloaded
> > (needed) but the LoadEvent is not fired.
>
> > Is it because the web browser get the image in its cache ?
> > Is there any solution ?
>
> > I tried to save the image on a hashmap and use it when the same image
> > is reloaded, it works but but my program can have several times the
> > same image on the same panel, so the image appeared only once.
>
> > Regards,
--~--~---------~--~----~------------~-------~--~----~
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