1: import javax.swing.ImageIcon; 2: import javax.swing.JApplet; 3: import javax.swing.JLabel; 4: 5: public class IconDemo extends JApplet 6: { 7: public void init( ) 8: { 9: JLabel niceLabel = new JLabel("Java is fun!"); 10: ImageIcon dukeIcon = new ImageIcon("duke_waving.gif"); 11: niceLabel.setIcon(dukeIcon); 12: getContentPane( ).add(niceLabel); 13: } 14: }