From owner-freebsd-java Thu Jul 15 7:54:36 1999 Delivered-To: freebsd-java@freebsd.org Received: from mail.HiWAAY.net (fly.HiWAAY.net [208.147.154.56]) by hub.freebsd.org (Postfix) with ESMTP id 35F081559A for ; Thu, 15 Jul 1999 07:54:25 -0700 (PDT) (envelope-from sprice@hiwaay.net) Received: from localhost (sprice@localhost) by mail.HiWAAY.net (8.9.1a/8.9.0) with ESMTP id JAA21685; Thu, 15 Jul 1999 09:54:17 -0500 (CDT) Date: Thu, 15 Jul 1999 09:54:17 -0500 (CDT) From: Steve Price To: Nate Williams Cc: Joachim Jaeckel , freebsd-java@FreeBSD.ORG Subject: Re: problems loading images for buttons? In-Reply-To: <199907151427.IAA02100@mt.sri.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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