Nov

03

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”MyAppEvent1.class” width=”400″ height=”400″>
</applet>
*/
public class MyAppEvent1 extends Applet implements MouseListener{
public void init(){
addMouseListener(this);
}
public void mouseExited(MouseEvent e){
System.out.println(“mouseExited”);
}
public void mouseEntered(MouseEvent e){
System.out.println(“mouseEntered”);
}
public void mouseReleased(MouseEvent e){
System.out.println(“mouseReleased”);
}
public void mousePressed(MouseEvent e){
System.out.println(“mousePressed”);
}
public void mouseClicked(MouseEvent e){
System.out.println(“mouseClicked”);
}
}

 

//—————————————————————————————-

 

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”MyAppEvent2.class” width=”400″ height=”400″>
</applet>
*/
public class MyAppEvent2 extends Applet implements MouseListener{
public void init(){
addMouseListener(this);
}
String msg=””;
public void mouseExited(MouseEvent e){
msg=”MouseExited”;
repaint();
}
public void mouseEntered(MouseEvent e){
msg=”MouseEntered”;
repaint();
}
public void mouseReleased(MouseEvent e){
msg=”MouseReleased”;
repaint();
}
public void mousePressed(MouseEvent e){
msg=”MousePressed”;
repaint();
}
public void mouseClicked(MouseEvent e){
msg=”MouseClicked”;
repaint();
}
public void paint(Graphics g){
g.drawString(msg,100,100);
}
}

 

//———————————————————————————-

 

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”MyAppEvent3.class” width=”400″ height=”400″>
</applet>
*/
public class MyAppEvent3 extends Applet implements MouseListener{
public void init(){
addMouseListener(this);
}
String msg=””;
public void mouseExited(MouseEvent e){
msg=”MouseExited”;
repaint();
}
public void mouseEntered(MouseEvent e){
msg=”MouseEntered”;
repaint();
}
public void mouseReleased(MouseEvent e){
msg=”MouseReleased”;
repaint();
}
public void mousePressed(MouseEvent e){
msg=”MousePressed”;
repaint();
}
int x=40,y=40;
public void mouseClicked(MouseEvent e){
x=e.getX();
y=e.getY();
msg=”MouseClicked”;
repaint();
}
public void paint(Graphics g){
showStatus(x+”,”+y);
g.drawString(msg,x,y);
}
}

 


Leave a Reply