Temporarily disable or prevent repainting JViewPort on scrolling with a mouseDrag
I have written a MouseListener as defined below so that I can move a JButton around to reorder the components that are within the JPanel . The JPanel is within a JScrollPane so that when multiple components are added they can be scrolled. The problem I have is that when dragging the component and the mouse goes out of the scrollpane/viewport then the component will snap back to its position within the JPanel then will be drawn in the correct location. I assume that this behavior is due to the Viewport calling a repaint of its children when I call scrollRectToVisible() Is there a way that I can