Re: A problem; please help.
From: Andrew Thompson (SeeMySites_at_www.invalid)
Date: 12/30/04
- Next message: William Brogden: "Re: Tomcat classpath"
- Previous message: Ryan Stewart: "Re: A problem; please help."
- In reply to: H. Sommers: "A problem; please help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Dec 2004 14:12:30 GMT
On Thu, 30 Dec 2004 15:01:22 +0100, H. Sommers wrote:
> private void picture()
> {
> ImageIcon pic = new ImageIcon("images/duke.gif");
> jButton1.setIcon(pic);
> }
You are working blind here, try this instead..
URL imageURL = this.getClass().getResource( "images/dike.gif" );
System.out.println( "imageURL: " + imageURL );
ImageIcon pic = new ImageIcon( imageURL );
...
BTW - You're subject.. 'A problem; please help' is an extremely
poor one, something like 'ImageIcon does not appear in application'
would be much better.
HTH
-- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane
- Next message: William Brogden: "Re: Tomcat classpath"
- Previous message: Ryan Stewart: "Re: A problem; please help."
- In reply to: H. Sommers: "A problem; please help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]