import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class Mouse2 extends Applet implements
MouseListener,MouseMotionListener {
private String s="";
private String s1="";
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){
s1="";
if(e.isMetaDown())
s1+="dexio pathma";
else if(e.isAltDown())
s1+="mesaio pathma";
else s1="aristero pathma";
setState(s1,e.getX(),e.getY());
}
public void mousePressed(MouseEvent e){
s1="";
if(e.isMetaDown())
s1+="dexio pliktro";
else if(e.isAltDown())
s1+="mesaio pliktro";
else s1="aristero pliktro";
setState("piestike to "+s1,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