Loading an image using GWT 1.6.4

973 views
Skip to first unread message

Fabrício Cabral

unread,
Apr 12, 2009, 7:38:37 AM4/12/09
to Google Web Toolkit
Hello all,

I'm trying loading an image in GWT 1.6.4 but I don't know where put the
image file. Every time that I run host mode, GWT doesn't found the file.
Could anyone help me?

Thanks in advance,

--
--fx

hezjing

unread,
Apr 12, 2009, 10:03:35 AM4/12/09
to Google-We...@googlegroups.com
Hi Fabrício,

2009/4/12 Fabrício Cabral <fabri...@gmail.com>


Hello all,

I'm  trying loading an image in GWT 1.6.4 but I don't know where put the
image file. Every time that I run host mode, GWT doesn't found the file.
Could anyone help me?

I saved my images in war/images directory, and here is how I create the Image:

Image img = new Image("images/test-1.jpg")


--

Hez

Fabrício Cabral

unread,
Apr 13, 2009, 2:20:35 AM4/13/09
to Google-We...@googlegroups.com
On Sun, Apr 12, 2009 at 11:03 AM, hezjing <hez...@gmail.com> wrote:

> Hi Fabrício,

Hi Hez!

> I saved my images in war/images directory, and here is how I create the
> Image:
> Image img = new Image("images/test-1.jpg")

It worked fine but I don't know if is it the "right way" because the GWT 1.6
documentation says we should use GWT.getModuleBaseURL() to locate
our static resources like images, css files, etc.

So, you or anyone knows where I should put my static resources to access
them via GWT.getModuleBaseURL() .

Thank you very much,

--
--fx

Magius

unread,
Apr 13, 2009, 5:37:52 AM4/13/09
to Google Web Toolkit
Hi,

you have to use GWT.getModuleBaseURL() to reference module related
resources.
If you have generic images you can put them in 'war/images' and access
them as indicated above.


On Apr 13, 8:20 am, Fabrício Cabral <fabrici...@gmail.com> wrote:

Fabrício Cabral

unread,
Apr 13, 2009, 12:14:58 PM4/13/09
to Google-We...@googlegroups.com
On Mon, Apr 13, 2009 at 6:37 AM, Magius <antonio....@gmail.com> wrote:
> Hi,

Hi,

> you have to use GWT.getModuleBaseURL() to reference module related
> resources.
> If you have generic images you can put them in 'war/images' and access
> them as indicated above.

Ah, ok! Thank you very much,

--
--fx

Reply all
Reply to author
Forward
0 new messages