// Add your handling code here:
Container container = pnlInScroll.getParent();
if (container instanceof JViewport)
{
JViewport viewport = (JViewport) container;
Point point = viewport.getViewPosition();
int newX = point.x - (evt.getX() - downX);
int newY = point.y - (evt.getY() - downY);
int maxX = pnlInScroll.getWidth() - viewport.getWidth();
int maxY = pnlInScroll.getHeight() - viewport.getHeight();
if (newX < 0)
{
newX = 0;
}
if (newX > maxX)
{
newX = maxX;
}
if (newY < 0)
{
newY = 0;
}
if (newY > maxY)
{
newY = maxY;
}
viewport.setViewPosition(new Point(newX, newY));
}
}//GEN-LAST:event_pnlLinksMouseDragged