View Single Post
  #1 (permalink)  
Old 12-06-2007, 04:47 PM
Soda Soda is offline
Member
 
Join Date: Dec 2007
Posts: 15
Soda is on a distinguished road
How to set an Icon in a Label?
I cant seem to put images in a label. I have tried a lot of codes and still cant get it.... Any tips?

Quote:
Here are some codes:

Code : lName.setIcon("./IMG/name_icon.jpg");

Error : setIcon(javax.swing.Icon) in javax.swing.JLabel cannot be applied to (java.lang.String)


Code : Image icon = createImageIcon("./IMG/name_icon.jpg");
lName = new JLabel(icon);

Error : cannot find symbol method createImageIcon(java.lang.String)
cannot find symbol constructor JLabel(java.awt.Image)
Reply With Quote
Sponsored Links