// Convert the point to glass pane coordinates
Point offset = SwingUtilities.convertPoint(subject, x, y, gp);
// Draw the target rectangle
Rectangle targetRect = new Rectangle(offset.x, offset.y, subject.getWidth(), subject.getHeight());
gp.drawRectangle(targetRect, true);
}
private void clearTargetRect()
{
// Deactivate the drag shadow glass pane again