Question

I'm working on a board game in Java with a Swing GUI. Basically I subclassed the JScrollPane class and made it scrollable (DragableScrollPane = DSP) just by dragging the mouse. The view of the DSP is set to a subclassed JPanel (BoardView = BV).

  • I have a MouseAdapter subclass listening for mouse events on the DSP, to capture the mouseDragged gesture ==> To pan the scroll-pane

  • I have a DragGestureListener implementation listening for mouse events on BV, to capture the dragGestureRecognized gesture ==> To recognize when a game tile is being dragged, so it can be placed somewhere else on the board.

Problem: The dragGestureRecognized event in BV overrides the mouseDragged event in DSP. This is fine when the user drags a game tile, but when he/she clicks and drags somewhere else, I want that the mouseDragged event is fired instead to pan the view.

Thanks for reading!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top