Hi Kahkean, Welcome to the ranch!
kahkean chor wrote:Class myClass = this.getClass();
URL url = myClass.getResource("image/us.gif");
may i know,what is the purpose of initiated myclass using this.getClass?
The getClass() method gets a reference to an Object's Class. You have an instance of the Class (this) and you need a reference to the Class (because the Class Object has the getResource() method used to generate a URL relative to its package), so you call this.getClass().
kahkean chor wrote:and can some 1 tell me what is the different between imageicon and image.......thanks in advanced.
please dont shot me,i already try to search this stuffs ,however i still hard to understand because i am poor in english
The differences are many. You can read about the two classes in their API:
java.awt.Image
javax.swing.ImageIcon
Differences begin with one is in the AWT package, the other is Swing, on is abstract, the other is not. One knows how to open images and draw them from a URL, the other requires subclasses which you use to provide pixel data...