简体   繁体   中英

java move image with mouse

我想将此图像放置在地图上,所以我想要:-单击按钮并制作新图像-用鼠标移动图像,单击时图像必须位于jpanel上并且不再移动。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM