Source of DukeApplet.java


  1: 
  2: import javax.swing.JApplet;
  3: import javax.swing.JLabel;
  4: import javax.swing.ImageIcon;
  5: import java.awt.BorderLayout;
  6: import java.awt.Container;
  7: 
  8: public class DukeApplet extends JApplet
  9: {
 10:     public void init( )
 11:     {
 12:         Container contentPane = getContentPane( );
 13:         contentPane.setLayout(new BorderLayout( ));
 14: 
 15:         JLabel spacer = new JLabel("             ");
 16:         contentPane.add(spacer, "West");
 17:         JLabel friendlyLabel = new JLabel("Hello out there!");
 18:         ImageIcon dukeIcon = new ImageIcon("duke_waving.gif");
 19:         friendlyLabel.setIcon(dukeIcon);
 20:         contentPane.add(friendlyLabel, BorderLayout.CENTER);
 21:     }
 22: }