Wednesday, August 17, 2011

Adapter in applet

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


*/

public class adapt1 extends Applet
{
public void init()
{
addMouseListener(new MyMouse(this));
}

class MyMouse extends MouseAdapter
{
MyMouse(adapt1 a)
{

}
public void mouseClicked(MouseEvent me)
{
setBackground(Color.red);
}
public void mouseEntered(MouseEvent me)
{
setBackground(Color.blue);
}
}
}


No comments:

Post a Comment