Hi everyone,
I am currently working on a drag n drop application and I would really like to know what's happening inside the JLayeredPane and I get a particular program behaviour...
Here's the deal:
I have a chessboard placed on the DEFAULT_LAYER.
I also have a chessPiece which I'd like to be added to the DRAG_LAYER when I move it.
But I have a fetish...
I want to use this line
layeredPane.add(chessPiece, JLayeredPane.DRAG_LAYER);
only under the mouseDragged event.
So, when I do this, my chessPiece disappears while moving my mouse and gets hidden behind the chessboard (?!?)
When I change the above line into this:
layeredPane.add(chessPiece, JLayeredPane.DRAG_LAYER,0);
everything becomes normal again.
Why is that happening?