How to create an image map using Java Swing?

后端 未结 2 1831
猫巷女王i
猫巷女王i 2021-01-26 02:40

I need to make an image map using Swing that displays a background image, and then when the mouse hovers over (or clicks) specific hotspots, I need to pop up a \'zoomed-in\' ima

2条回答
  •  独厮守ぢ
    2021-01-26 03:17

    To listen to the mouse clicks implement the MouseListener interface, and add it to your panel. Then when the click is recieved you can use a JPopupMenu as you suggested, or you could even use a glass pane to show the zoomed in image.

    I'm guessing you want to achieve something similar to this post by Joshua Marinacci, he has also posted the source here, I would take a look at that.

提交回复
热议问题