import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class Mouse1 extends Applet implements
MouseListener,MouseMotionListener {
private String s="";
private int x,y;
public void init() {
addMouseListener(this);
addMouseMotionListener(this);
}
public void paint(Graphics g){
g.drawString(s+ " "+"("+x+","+y+")",x,y);
}
public void setState(String s1,int x1,int y1){
s=s1;
x=x1;
y=y1;
repaint();
}
public void mouseClicked(MouseEvent e){
setState("klik",e.getX(),e.getY());
}
public void mousePressed(MouseEvent e){
setState("piestike to pliktro",e.getX(),e.getY());
}
public void mouseReleased(MouseEvent e){
setState("apeley8erw8hke to pliktro",e.getX(),e.getY());
}
public void mouseEntered(MouseEvent e){
showStatus("to pontiki einai mesa sthn perioxh tou applet ");
}
public void mouseExited(MouseEvent e){
showStatus("to pontiki einai exw apo thn perioxh tou applet ");
}
public void mouseDragged(MouseEvent e){
setState("to pontiki suretai",e.getX(),e.getY());
}
public void mouseMoved(MouseEvent e){
setState("to pontiki suretai",e.getX(),e.getY());
}
}
Thursday, July 16, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment