import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Moumotion extends JFrame {
public Moumotion()
{
super("BUTTON TEST");
addMouseListener( new MouseClickHandler());
addMouseMotionListener( new MouseMotionHandler());
setSize(200,300);
setVisible(true);
}
public static void main(String args[])
{
Moumotion bt = new Moumotion();
bt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
}
private class MouseClickHandler extends MouseAdapter{
public void mouseClicked(MouseEvent e)
{
setTitle("Mouse Clicked");
repaint();
}
}
class MouseMotionHandler extends MouseMotionAdapter{
public void mouseMoved(MouseEvent e)
{
setTitle("Mouse Moved");
}
}
}