File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes about setIconImage() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "about setIconImage()" Watch "about setIconImage()" New topic
Author

about setIconImage()

eLL Pascual
Greenhorn

Joined: May 22, 2008
Posts: 21
How can I make setIconImage() work?

this is my source code:

code:
----------------------------------------------------------------------------

public notepad(){//constructor
...
...
loadFrameIcon();
}

private void loadFrameIcon(){
URL imgURL = null;
ImageIcon imgIcon = null;

imgURL = notepad.class.getResource("images/notepadIcon.gif");
imgIcon = new ImageIcon(imgURL);
Image img = imgIcon.getImage();
this.setIconImage(img);
}

----------------------------------------------------------------------------

the error is:

cannot find symbol
this.setIconImage(img);
symbol: method setIconImage(java.awt.Image)
location: class notepad

Should I import something?
In the tutorial, the only import is .ImageIcon;

Thanks!
Norazanita Adnan
Ranch Hand

Joined: May 28, 2008
Posts: 44


hope this can help you...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Originally posted by eLL Pascual:
How can I make setIconImage() work?

By either creating the method yourself, or have your class extend a class with the method like JFrame.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: about setIconImage()
 
Similar Threads
Loading an Image
Refresh problem in applet
how to change the ImageIcon of a JLabel?
how to display an image for window icon in Swings
Icons and Images question