开发者

java move image with mouse

开发者 https://www.devze.com 2022-12-20 20:42 出处:网络
i want to put this image on a map, so i want:开发者_JS百科 - click a button and make a new image - move the image with the mouse and when click the image must be on the jpanel and not move anymore.Use

i want to put this image on a map, so i want:开发者_JS百科 - click a button and make a new image - move the image with the mouse and when click the image must be on the jpanel and not move anymore.


Use the jpanel as a canvas to draw the map and the image at a certain position.

Listen to the mouse move events, change the position of the image to the current position of the mouse. Redraw the canvas.

Add a mouse click listener and when you get a click, disable the mouse move listener.

0

精彩评论

暂无评论...
验证码 换一张
取 消