by Dinesh Thakur Category: AWT and Applets

 

import java.applet.Applet;

import java.awt.*;
import java.awt.event.*;
/*<APPLET CODE=JavaExampleFindObjInApplet.class WIDTH=210 HEIGHT=210 ></APPLET>*/
public class JavaExampleFindObjInApplet extends Applet implements ActionListener
  {
      TextArea TxtArea;
      Button BtnFnd;
      public void init()
         { 
             TxtArea = new TextArea("Now The Time is.",10,25,TextArea.SCROLLBARS_BOTH);
             add(TxtArea);
             BtnFnd = new Button("Find\"Time\"");
             add(BtnFnd);
             BtnFnd.addActionListener(this);
         }
            public void actionPerformed(ActionEvent e1)
               {
                   if(e1.getSource() == BtnFnd)
                 {
                        String S1 = TxtArea.getText();
                        String S2 = new String("Time");
                         int Lct = S1.indexOf(S2);
                         TxtArea.select(Lct,Lct+S2.length()) ;
                     }
              } 
  }

Find in Java Applet Example



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), 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