how to display image in JFrame

i am comfortable with displaying an image in applets ,but i am not able to display image in JFramesi used Image img=getImage(getDocumentBase(),"sample.jpg");its displaying an error cant find symbol getDocumentBase()
[261 byte] By [santosh@mvgra] at [2007-11-26 22:47:51]
# 1

It is a method of Applet. If you have a question of what methods

are available in a given class, the very first thing you should do is check the API:

http://java.sun.com/javase/6/docs/api/

Take a look at the code in reply #2: http://forum.java.sun.com/thread.jspa?threadID=5152350

DrLaszloJamfa at 2007-7-10 12:07:04 > top of Java-index,Java Essentials,New To Java...
# 2
I should have added that if the image is in the same loaction as the class file,you can give its URL as URL url = this.getClass().getResource("yourimage.jpeg");Good luck!
DrLaszloJamfa at 2007-7-10 12:07:04 > top of Java-index,Java Essentials,New To Java...