source code name: MouseDemo1.java
import java.awt.*;
import java.awt.event.*;
class MouseDemo1 extends Frame implements MouseListener
{
public MouseDemo1()
{
addMouseListener(this);
}
public void mousePressed(MouseEvent me)
{
System.out.println("mouse is Pressed");
}
public void mouseReleased(MouseEvent me){
System.out.println("mouse is Released");
}
public void mouseClicked(MouseEvent me){
System.out.println("mouse is Clicked");
}
public void mouseEntered(MouseEvent me){
System.out.println("mouse is Entered ");
}
public void mouseExited(MouseEvent me){
System.out.println("mouse is Exited");
}
public static void main(String[] args)
{
MouseDemo1 f=new MouseDemo1();
f.setSize(400,500);
f.setVisible(true);
}
}
output:
0 Comments
Post a Comment