Manu

Showing posts with label Develop and applet that receive one string and display in reverse fashion. Show all posts
Showing posts with label Develop and applet that receive one string and display in reverse fashion. Show all posts

Saturday, November 19, 2016

Develop and applet that receive one string and display in reverse fashion

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class revst extends Applet implements MouseMotionListener
{
            TextField t,t1;
            public void init()
            {
                        t=new TextField(25);
                        add(t);
                        t1=new TextField(25);
                        add(t1);
                        t1.addMouseMotionListener(this);
            }
            public void mouseMoved(MouseEvent m) {
                        StringBuffer st=new StringBuffer(t.getText());
                        st.reverse();
                        t1.setText(""+st);
            }
            public void mouseDragged(MouseEvent m){}
}

Output :