Set JButton to the location of another JButton

前端 未结 2 1474
清酒与你
清酒与你 2021-01-25 04:28

I\'m trying to move a JButton to the location of another one but the button I want to move moves to a wrong point. My idea is that this happens because I use multiple JPanels. I

2条回答
  •  -上瘾入骨i
    2021-01-25 04:53

    Maybe use mousePressed(),when you move the card,you press it until the target.And in the process, you get the information about JButton.getLocation() by the event,and than you need to solve the collision problem between two cards.So it's good!Of course, this is my advice ,you should have better idea!

提交回复
热议问题