How to drag and drop shape between two panels

柔情痞子 提交于 2019-12-11 10:57:32

问题


I have two panel, one on the left, which contains my shapes drawn on buttons, and the main panel on the left, where I drop the shapes

How can I implement a drag and drop ?

Edited

this the code I'am using actually that produce a kind of a dragging

  public void mouseReleased(MouseEvent e) {

                    CreateShapeCommand Cmd= new CreateShapeCommand(shape);
                    Caretaker.getInstance().execute(Cmd.copy(e.getX(),e.getY()));   
                }

回答1:


You should get familiar with this tutorial.



来源:https://stackoverflow.com/questions/5474653/how-to-drag-and-drop-shape-between-two-panels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!