Java Code

 import java.awt.*;
 import javax.swing.*;

 public class JLabelTextAndImageLeft extends JApplet
 {
          JLabel label;
          ImageIcon imgIcon;
          Image img;

          public void init()
          {
               img = getImage( getCodeBase( ), "oncomputer.png" );
               imgIcon = new ImageIcon( img );
               label = new JLabel( "Cookie Monster", imgIcon, JLabel.CENTER );
			   label.setHorizontalTextPosition( JLabel.LEFT );
               setLayout( new FlowLayout( ) );
               add( label );
          }
  }

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