How do I get the X and Y location of an image in a JScrollPane

前端 未结 2 1732
误落风尘
误落风尘 2021-01-07 10:43

I am trying to make a Map Editor for a 2D RPG, and what I currently am trying to do (to place tiles on the ground) is to have a JScrollPane with a JLabel (that has an image

2条回答
  •  猫巷女王i
    2021-01-07 10:53

    If you use JScrollPane for this, get the value of the vertical scrollbar, and add it to the Y value from the mouse listener and you will have the correct value

提交回复
热议问题