Java Code

 import javax.swing.*;
 import java.awt.*; 
 public class Check extends JApplet 
 {
   JCheckBox isHappy;
   JTextArea textarea;

   public void init( )
   {
		setLayout( new FlowLayout( ) );

		isHappy = new JCheckBox( "Happy?", true );
		textarea = new JTextArea( 3,10);

		if ( isHappy.isSelected( ) )
			textarea.setText( "You're so happy!" );
		else
		{
			textarea.setText( "Why not happy?" );
		}
	
		add( isHappy );
		add( textarea );
   }
 } 

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