Date: Thu, 15 Jul 1999 09:54:17 -0500 (CDT) From: Steve Price <sprice@hiwaay.net> To: Nate Williams <nate@mt.sri.com> Cc: Joachim Jaeckel <Joachim.Jaeckel@d.kamp.net>, freebsd-java@FreeBSD.ORG Subject: Re: problems loading images for buttons? Message-ID: <Pine.OSF.4.10.9907150942330.16749-100000@fly.HiWAAY.net> In-Reply-To: <199907151427.IAA02100@mt.sri.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 15 Jul 1999, Nate Williams wrote: # > I=B4ve a problem trying to load an image for a button. # >=20 # > The description of "new ImageIcon("images/middle.gif")" says, that it # > loads the image relative to the path where the class-file is. But if I= =B4m # > not in this path, the image isn=B4t loaded. I=B4m using jdk1.1.7 for Fr= eeBSD # > (the old static Version...). Is this a bug in the jdk or do I something # > wrong. #=20 # I'm almost positive this is 'standard behavior' of how things work. # Where is ImageIcon documented? In my experiences, you load 'resources' # out of the CLASSPATH, but certainly not images. I've found that code similar to this works as expected for me. =09ImageIcon(String imageName) { =09=09Toolkit t =3D Toolkit.getDefaultToolkit(); =09=09URL url =3D ClassLoader.getSystemResource(imageName); =09=09Image image =3D t.getImage(url); =09=09return(new ImageIcon(image)); =09} -steve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.4.10.9907150942330.16749-100000>