Java Code

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

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

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