Patch fro SwingResourceManager

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Patch fro SwingResourceManager

Postby dsissoko » Fri Nov 26, 2004 9:29 am

Inside a signed jar. Icon loaded with SwingResource appears to be corrupted.
The patch to correct this must be applied on the getImage method. The inpust stream must be a bufferedinputstream

example for getImage(Class clazz, String path)
public static Image getImage(Class clazz, String path) {
String key = clazz.getName() + "|" + path;
Image image = (Image) m_ClassImageMap.get(key);

if (image == null) {
if ((path.length() > 0) && (path.charAt(0) == '/')) {
String newPath = path.substring(1, path.length());
image = getImage(new BufferedInputStream(clazz.getClassLoader().getResourceAsStream(newPath)));
} else {
image = getImage(clazz.getResourceAsStream(path));
}

m_ClassImageMap.put(key, image);
}

return image;
}


hope it will help
dsissoko
 
Posts: 1
Joined: Fri Nov 26, 2004 9:19 am

Re: Patch fro SwingResourceManager

Postby Eric Clayberg » Fri Nov 26, 2004 2:28 pm

dsissoko wrote:Inside a signed jar. Icon loaded with SwingResource appears to be corrupted.
The patch to correct this must be applied on the getImage method. The inpust stream must be a bufferedinputstream
hope it will help

Thanks. I will include your fix in the next product build.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: Google [Bot] and 1 guest