0

Creating an Image progamatically

asked 2010-09-06 13:27:54 +0800

diego898 gravatar image diego898
246 3

updated 2010-09-06 14:31:57 +0800

Hello,

I have a Images folder inside my WebContent folder. In there I have 1.png and 2.png. I would like to make the content of a listitem an Image so I have done this:

this.pathToImagesFolder = Sessions.getCurrent().getWebApp().getRealPath("/Images/");
Image myImage = new Image(this.pathToImagesFolder + "/1.png");
myListItem.appendChild(myImage);

However that doesn't work? Any help?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-09-06 14:32:43 +0800

diego898 gravatar image diego898
246 3

I have also tried this to no avail:

Image myImage = new Image("/Images/1.png");
myListItem.appendChild(myImage);

Any ideas?

link publish delete flag offensive edit

answered 2010-09-06 15:44:49 +0800

SparkySpider gravatar image SparkySpider
444 1 3

I was having hassles a while ago as there are multiple libraries within ZK and AWT that have an Image object. The correct library is: org.zkoss.zul.Image;

Tested this code and it works perfectly:

Image image = new Image();
image.setSrc("http://www.google.com/intl/en_ALL/images/srpr/logo1w.png");
winLandingUser.appendChild(image);

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-09-06 13:27:54 +0800

Seen: 209 times

Last updated: Sep 06 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More