ok i was trying to do an Hovering method... which was looking like this:
but it didnt work when i pass my mouse on the image... i was getting the mouseX and mouseY position from the method mouseMoved :Code:public void method4(String s, int x1, int y1, int x2, int y2, int x3, int y3) { try{ Image i; Graphics g = frame.getGraphics(); Graphics2D g2 = (Graphics2D)g; i = ImageIO.read(new File("./Image/"+s)); frame.addMouseListener(ML); if(anInt1 >= x1 + x2 || anInt1 <= x1 - x2 && anInt2 >= y2 + y1 || anInt2 <= y2 - y1){ g2.drawImage(i, x3, y3, x2, y2, frame); println("Image "+s+"has sucessfully hovered"); } }catch (Exception e){ println("Error while loading hovering Image "+s+""); } }
... i dont know what is missing but there is surely something missing...Code:public final void mouseMoved(MouseEvent event){ int i = event.getX(); int j = event.getY(); anInt1 = i; anInt2 = j; }
note : the problem is not from the method, its just that my method mouseMoved doesnt work so i guess my MouseListener doesnt work but why?
if anyone know what am I missing I would very appreciate you tell me
And dosrry for my bad english... im french![]()



Reply With Quote


Bookmarks