cancel
Showing results for 
Search instead for 
Did you mean: 

hwo to set the image size in Java webdynpro view?

Former Member
0 Kudos

Hi Friends,

How to set the image size design time or programmatically in WebDynpro for Java?

Is there any way to set the image size? instead of taking the image size as original size?

nav

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

IWDImage has properties "width" and "height", so what's the problem?

Armin

Former Member
0 Kudos

Hi Armin, do we have any example how to do it programmatically?

Former Member
0 Kudos

Nav,

1. Create 2 context attributes of type "string", name them, say ImgW and ImgH

2. Bind width/height of Image UI control to this attributes.

3. In code change context attributes:


public void wdDoInit() {
  wdContext.currentContextElement().setImgW("100px");
  wdContext.currentContextElement().setImgH("200px");
}

VS

Former Member
0 Kudos

ohh, got it what you mean to say.

Thanks!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Armin,

What about if I want to size my Dynpro image according to the actual image size which might not be known until runtime.

Suppose I am fetching an image from an URL is it possible to get the dimensions of the image in this case?

It is possible to do it in swing but is it possible to use the ImageObserver class in dynpros?

regards,

Deepak

Former Member
0 Kudos

(I have no idea if the following would work from within a Web Dynpro event handler):

javax.swing.ImageIcon image = new javax.swing.ImageIcon(url);
wdContext.currentContextElement().setImageWidth(image.getIconWidth());
wdContext.currentContextElement().setImageHeight(image.getIconHeight());

Armin

Former Member
0 Kudos

Hi Armin,

I will try it.