Mouse event in Java

Posted by Harish on Stack Overflow See other posts from Stack Overflow or by Harish
Published on 2010-06-17T09:49:05Z Indexed on 2010/06/17 9:53 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

I am trying to move a JComponent say a label over a table.I am tracking this event using MouseMotionListener's mouseDragged method.This method perfectly helps me in tracking the item.Is there a way to track the mouse release after dragging is complete(.ie the dropping event).

 tktLabel1.addMouseMotionListener(new MouseMotionListener()
            {

                public void mouseDragged(MouseEvent arg0)
                {
                    tktLabel1.setBounds(tktLabel1.getX() + arg0.getX(),
                            tktLabel1.getY() + arg0.getY(), width, height);

                }

                public void mouseMoved(MouseEvent arg0)
                {

                }
            });

© Stack Overflow or respective owner

Related posts about java

Related posts about jtable