by Dinesh Thakur

 

import java.awt.*;

import javax.swing.*;
import java.awt.event.*;
/*<APPLET CODE=CheckImagesInJavaAppletSwing.class WIDTH=350 HEIGHT=210> </APPLET>*/
public class CheckImagesInJavaAppletSwing extends JApplet implements ItemListener
  {
      JCheckBox ChkOne;
      JTextField Txt;
      public void init()
       {
         Container cntnr = getContentPane();
         cntnr.setLayout(new FlowLayout());
         ChkOne = new JCheckBox("Check For Image", new ImageIcon("Java.jpg"));
         ChkOne.setSelectedIcon(new ImageIcon("Koala.jpg"));
         ChkOne.addItemListener(this);
         cntnr.add(ChkOne);
         Txt = new JTextField(25);
         cntnr.add(Txt);
      }
         public void itemStateChanged(ItemEvent e1)
         {
            if (e1.getItemSelectable() == ChkOne)
               {
                 Txt.setText("You Clicked For The Next Image");
               }
         }
  }

Check Images in Java Applet Example