I am seeking a solution and found this mail.
This is a very useful implementation.
I strongly suggest future wicket to include this Component.

Thank you , Jeremy

--
smallufo


2008/10/8 Jeremy Thomerson <jer...@wickettraining.com>

> This doesn't preload the images, but it is a simple way to do a Mouseover.
> You could easily add a header contributor within the constructor of this
> class that outputs some javascript to preload the images.
>
> public class MouseoverImage extends Image {
>  private static final long serialVersionUID = 1L;
>
>  private final ResourceReference mImage;
>  private final ResourceReference mMouseoverImage;
>
>  public MouseoverImage(String id, ResourceReference image,
> ResourceReference
> mouseoverImage) {
>  super(id, image);
>  mImage = image;
>  mMouseoverImage = mouseoverImage;
>  add(new AttributeModifier("onmouseover", null, true, new
> LoadableDetachableModel<String>() {
>   private static final long serialVersionUID = 1L;
>   @Override
>   protected String load() {
>    return "this.src='" + urlFor(mMouseoverImage) + "';";
>   }
>
>  }));
>  add(new AttributeModifier("onmouseout", null, true, new
> LoadableDetachableModel<String>() {
>   private static final long serialVersionUID = 1L;
>   @Override
>   protected String load() {
>    return "this.src='" + urlFor(mImage) + "';";
>   }
>
>  }));
>  }
> }
>

Reply via email to