Hello,
Can someone please advise on the correct procedure for creating
repeating images in GWT.  I've read the GWT documentation and some
other posts with similar problems but am having no luck getting images
to repeat.  The image in question is for a custom button and is 1x24
pixels in size.

Code snippets:


1) The client bundle for managing the css and image resources

public interface ButtonResources extends ClientBundle {
        public ButtonResources INSTANCE = GWT.create(ButtonResources.class);

        public interface ButtonCSS extends CssResource {
                String buttonBody();
        };

        @Source("Button.css")
        ButtonCSS css();

        @Source("StandardButtonLeft8x24.png")
        ImageResource buttonLeft();

        @Source("StandardButtonMiddle1x24.png")
        @ImageOptions(repeatStyle=RepeatStyle.Horizontal)
        ImageResource buttonMiddle();

        @Source("StandardButtonRight8x24.png")
        ImageResource buttonRight();
}


2) css file (Button.css)

@sprite .buttonBody {
        gwt-image: "buttonMiddle";
}


3) usage

sample 1:

AbsolutePanel ip = new AbsolutePanel();
ip.setStyleName(ButtonResources.INSTANCE.css().buttonBody());
ip.setSize("80px", "24px");
RootPanel.get("testContainer").add(ip);

sample 2:

Image image = new Image(ButtonResources.INSTANCE.buttonMiddle());
image.setSize("100px", "24px");
RootPanel.get("testContainer").add(image);


Results:
Using the above code, sample 1 produces no image at all while sample 2
produces the original image of 1x24 pixel size.

Any help would be appreciated!
Thank You.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to