by Dinesh Thakur Category: AWT and Applets


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"));
         Txt = new JTextField(25);
         public void itemStateChanged(ItemEvent e1)
            if (e1.getItemSelectable() == ChkOne)
                 Txt.setText("You Clicked For The Next Image");

Check Images in Java Applet Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles