Java Tutorial

 
 
 
 
/* <applet code=\"concat2Str\" height=150 width=350>
   </applet> */

import java.awt.*;
import java.applet.*;

public class concat2Str extends Applet
{
       TextField Ts1,Ts2;

       public void init(){
            Ts1 = new TextField(10);
            Ts2 = new TextField(10);
            add(Ts1);
            add(Ts2);
            Ts1.setText(\"\");
            Ts2.setText(\"\");
        }

        public void paint(Graphics g){
            String str1,str2;

            g.drawString(\"Enter Two String to Concat Them \",10,50);

            str1=Ts1.getText();
            str2=Ts2.getText();
            g.setColor(Color.red);
            g.drawString(str1+\" \"+str2,10,70);
            showStatus(\"Concatination of 2 String\");
     }

     public boolean action(Event e, Object o){
           repaint();
           return true;
    }

}

 
 
Didn't find what you were looking for? Find more on An applet program that concatenates two string entered in TextField