Java Code

/** Example showing drawString and font methods
 *  @author : E.S.Boese
 *  @version: Fall 2008
 */ 
import java.awt.*;
import javax.swing.*;
public class JLabelWithImage extends JApplet
{
	Image img;
	ImageIcon imgIcon;
	JLabel label;

   public void init( ) 
   {
		img = getImage( getCodeBase( ), "door.jpg" );
		imgIcon = new ImageIcon( img );
		label = new JLabel( imgIcon );
		setLayout( new FlowLayout( )  );
		add( label );
   }
}

Back to Code Examples
©2006- by E.S.Boese. All Rights Reserved