You might do it with some CSS provided that you are not targeting IE6.

1. Make a div with fixed dimensions
2. Put the label and the image into the div
3. The initial style for the label should be absolute positioning and
hidden. You can play with margins to place the label anywhere ove rthe
image
4. Use the :hover pseudoclass to display the label

The downside is that you need a copy of the label in every image.

But before you go too far: are you sure the image's alt="" attribute
(gwt jargon: title) doesn't suffice?

On Jul 21, 10:16 pm, nacho <[email protected]> wrote:
> Hi, i want to do the following, i want to display a label when the
> user passes the mouse over the image and i want to hide the label when
> the user takes out the mouse from the image. Just like a toolkit.
>
> What i did is the following, what am i missing?
>
> final Label lblRecyclerBin = new Label("Recycler Bin");
>                 lblRecyclerBin.setVisible(false);
>
>                 RootPanel.get().add(lblRecyclerBin);
>
>                 final Image imgRecyclerBin = new 
> Image("images/icons/trashcan.png");
>                 imgRecyclerBin.setHeight("40px");
>                 imgRecyclerBin.setWidth("40px");
>                 imgRecyclerBin.setStylePrimaryName("reflex");
>
>                 imgRecyclerBin.addMouseOverHandler(new MouseOverHandler() {
>                         public void onMouseOver(MouseOverEvent arg0) {
>                                 lblRecyclerBin.setVisible(true);
>
>                                 
> RootPanel.get().setWidgetPosition(lblRecyclerBin,
> imgRecyclerBin.getAbsoluteLeft(), imgRecyclerBin.getAbsoluteTop());
>                         }
>                 });

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