create an interface:
public interface Resource extends ClientBundle{
@Source("theimage.png")
ImageResource theimage();
}
place the "theimage.png" file in the same package as the interface.
to use the interface:
Resource resource = GWT.create(Resource.class);
//make the file menu
MenuBar filemenu = new MenuBar(true);
filemenu.addItem("<img src='" + resource.theimage().getURL() + "'/
>File", true, new Command() {
public void execute() {
//what to do
}
});
filemenu.addItem("<img src='" + resource.theimage().getURL() + "'/
>Open", true, new Command() {
public void execute() {
//what to do
}
});
filemenu.addItem("<img src='" + resource.theimage().getURL() + "'/
>Save", true, new Command() {
public void execute() {
//what to do
}
});
//add the file menu to the menubar
MenuBar bar = new MenuBar();
bar.addItem("File", filemenu);
RootPanel.get().add(bar);
this is a pretty crude way to do it, but it works.
you can check MenuBar(boolean vertical, MenuBar.Resources resources)
in the documentation
i think that how you're supposed to use images, but i haven't tried it
yet.
--
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.