try this:
<code>
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
public class ImageLink extends Widget {
private Image img;
private String url;
private String target;
private DivElement element;
private AnchorElement aEl;
public ImageLink(Image img, String url){
initElements();
setImg(img);
setUrl(url);
}
private void initElements() {
element = Document.get().createDivElement();
aEl = Document.get().createAnchorElement();
element.appendChild(aEl);
setElement(element);
sinkEvents(Event.MOUSEEVENTS);
setTarget("_blank");
}
public void onBrowserEvent(Event event) {
if(event.getTypeInt() == Event.ONMOUSEOVER){
aEl.getStyle().setProperty("cursor", "hand");
}
super.onBrowserEvent(event);
}
public ImageLink(){
this(null, "");
}
/**
* @return the img
*/
public Image getImg() {
return img;
}
/**
* @param img the img to set
*/
public void setImg(Image img) {
this.img = img;
aEl.appendChild(img.getElement());
}
/**
* @return the url
*/
public String getUrl() {
return url;
}
/**
* @param url the url to set
*/
public void setUrl(String url) {
this.url = url;
aEl.setHref(url);
}
/**
* @return the target
*/
public String getTarget() {
return target;
}
/**
* @param target the target to set
*/
public void setTarget(String target) {
this.target = target;
aEl.setTarget(target);
}
}
</code>
then you use your ImageBundle and pass the image to this widget...
hope it helps you :)
On Sep 26, 6:17 pm, Jean-Lou Dupont <[EMAIL PROTECTED]> wrote:
> The work-around for anybody who cares: add a 'click listener' to the
> Anchor widget and do the navigation "manually".
> Yet another reason why I don't like IE as much as the others...
>
> On Sep 26, 11:43 am, Jean-Lou Dupont <[EMAIL PROTECTED]> wrote:
>
> > How would I go in creating a cross-browser Image Anchor ( i.e. <a
> > href="#somewhere"><img src="somegraphic.png"></a> ) using an image
> > bundle?
>
> > I am having some troubles with IE6: there is an extra tag called
> > "clipper" (e.g. <clipper class=gwt-Image ...> ) that seems to be
> > created with a style attribute that prevents the image from being
> > clickable i.e. navigating to the anchor's link when clicked.
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---