MenuItem AddItem()

I cannot get an icon to appear in my menu - it shows as a broken link.
When I try to open the broken link, I get an error

The image http://localhost:8080/NBVaadinNav03/VAADIN/themes/mytheme/artwork/untitled.png cannot be displayed because it has errors.
. . .

In the UI class I do this … (NPVaadinNav03 is the project name)
public class NBVaadinNav03 extends UI{
// it also adds a default view and goes to it.
// The problem is the next line (the menu does display, but the icon does not
MenuItem mi011 = mi01.addItem(“011”, new ThemeResource(“artwork/untitled.png”), null);

// after reading this page -
// it appears I have done it correctly.
// The folder ‘artwork’ is under the theme, the file ‘untitled.png’ is there.

Any ideas?

A couple of things to try:

  1. can you access the image by copypasting that URL to your browser?
  2. how do you deploy the app? are you sure your theme folder is deployed?
  3. are other things in your theme working?
  4. Shouldn’t be an issue for you, but depends on your deployment: do you have a web.xml or do you use annotations for deployment? is your vaadin app deployed on something else than root? ( /* )

Good questions.

If a theme does not deploy with a WAR, then I guess I’m not deploying the theme? I will look into deploying themes. Thanks for responding, I’ll let you know how your suggestions work.

The theme should be packaged inside the WAR, but it depends on how your are creating the WAR file. E.g. eclipse should automatically add the VAADIN directory to your archive. I just meant that you should double-check that the themes are actually in the created deployment file :slight_smile:

Instead of running in debug, I created WAR, started Tomcat and deployed WAR to Tomcat from Tomcat manager.
It runs.
All of the assets are deployed, including theme. In Tomcat webapps …


It’s there. and the URL is correct.

Are other things in your theme working?

I am going to check that out now…