Integrate fix advised by Heng Sin to solve a problem rendering images from AD_Client.Logo_ID on jasper reports

This commit is contained in:
Carlos Ruiz 2011-02-27 00:33:34 -05:00
parent 45200670fb
commit 4882320f29
1 changed files with 9 additions and 1 deletions

View File

@ -16,7 +16,9 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.awt.Container;
import java.awt.Image; import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
@ -116,6 +118,9 @@ public class MImage extends X_AD_Image
{ {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
m_image = tk.createImage(data); m_image = tk.createImage(data);
MediaTracker mediaTracker = new MediaTracker(new Container());
mediaTracker.addImage(m_image, 0);
mediaTracker.waitForID(0);
return m_image; return m_image;
} }
catch (Exception e) catch (Exception e)
@ -132,6 +137,9 @@ public class MImage extends X_AD_Image
{ {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
m_image = tk.getImage(url); m_image = tk.getImage(url);
MediaTracker mediaTracker = new MediaTracker(new Container());
mediaTracker.addImage(m_image, 0);
mediaTracker.waitForID(0);
return m_image; return m_image;
} }
catch (Exception e) catch (Exception e)