Manu

Saturday, November 19, 2016

Write a simple program for mouselistener

import java.applet.*;
import java.awt.*;
import java.awt.event.*;       
public class Mous extends Applet implements MouseListener
{
public void init()
{
addMouseListener(this);        
}
public void mouseClicked(MouseEvent e)
{
            setBackground(Color.green);
           
}
public void mouseEntered(MouseEvent e)
{
            setBackground(Color.blue);
}
public void mouseExited(MouseEvent e)
{
            setBackground(Color.yellow);
}
public void mouseReleased(MouseEvent e)
{
            setBackground(Color.pink);
}

}

Output :


No comments:

Post a Comment