Wednesday, August 17, 2011

Applet program using mouseListener

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*


*/
public class mouse1 extends Applet implements MouseListener
{
public void init()
{
addMouseListener(this);
}

public void mouseClicked(MouseEvent me)
{
setBackground(Color.yellow);
}

public void mousePressed(MouseEvent me)
{
setBackground(Color.red);
}

public void mouseReleased(MouseEvent me)
{
setBackground(Color.orange);
}

No comments:

Post a Comment