1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| public class polux implements PlugIn {
public int flag ;
public int i=1 ;
public void run(String arg)
{
WindowManager.closeAllWindows();
IJ.open("C:\\Documents and Settings\\Flou\\Bureau\\Stage CHU\\IMAGES FOIE\\bonard\\Bonard076005.JPEG");
ImagePlus img = WindowManager.getCurrentImage();
ImageCanvas pp = new ImageCanvas(img);
pp.addMouseListener(new MouseAdapter(){
public void mouseExited(MouseEvent e)
{
IJ.showMessage("exit");
flag = 0;
}
public void mouseEntered(MouseEvent e)
{
IJ.showMessage("enter");
flag = 1;
}
});
IJ.setTool(4); //PERMET DE SELECTIONNER LA LIGNE pour tracer
Toolkit.getDefaultToolkit().addAWTEventListener(new MyListener(flag), AWTEvent.MOUSE_EVENT_MASK);
IJ.showMessage("Toolkit fin");
}
}
class MyListener implements AWTEventListener {
public static int flag;
public MyListener(int flag){
this.flag=flag; }
public static int i=0;
public void eventDispatched(AWTEvent event) {
{if (event.getID() == MouseEvent.MOUSE_RELEASED){
MouseEvent keyEvent = (MouseEvent) event;
if (flag == 0){
IJ.run("Draw");
i=i+1;
String txt_i = Integer.toString(i);
//IJ.showMessage(txt_i);
if (i==3)
{IJ.showMessage("ca marche");
}
else{IJ.showMessage("merde");}
}
else{
}
}
}
}
} |
Partager