Java Code

 import java.awt.*;
 import javax.swing.*;
	
 public class JLabelEx extends JApplet
 {
        JLabel  label1, label2;

   public void init( ) 
   {
        //Create the first label.
        label1 = new JLabel( "<HTML>Text<BR>on<BR>separate Lines", JLabel.CENTER );
	 
        //Create the other labels.
        label2 = new JLabel( "<HTML><FONT COLOR=RED>Cookie</FONT>Monster" );
	
        //Add the labels.
        setLayout(new FlowLayout( )  );
        add( label1 );
        add( label2 );
    }
 }

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