Added some extra checks for lingering icons.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1599 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -25,6 +25,8 @@ import javax.swing.Timer;
|
|||||||
import javax.swing.event.AncestorEvent;
|
import javax.swing.event.AncestorEvent;
|
||||||
import javax.swing.event.MouseInputAdapter;
|
import javax.swing.event.MouseInputAdapter;
|
||||||
|
|
||||||
|
import com.samskivert.Log;
|
||||||
|
|
||||||
import com.samskivert.swing.event.AncestorAdapter;
|
import com.samskivert.swing.event.AncestorAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -194,12 +196,34 @@ public class DnDManager
|
|||||||
{
|
{
|
||||||
Cursor c = comp.getCursor();
|
Cursor c = comp.getCursor();
|
||||||
if (c != _curCursor) {
|
if (c != _curCursor) {
|
||||||
|
assertComponentCursorCleared();
|
||||||
_lastComp = comp;
|
_lastComp = comp;
|
||||||
_oldCursor = comp.isCursorSet() ? c : null;
|
_oldCursor = comp.isCursorSet() ? c : null;
|
||||||
comp.setCursor(_curCursor);
|
comp.setCursor(_curCursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes sure the component cursor is cleared. If it isn't, generates a
|
||||||
|
* warning message and clears it.
|
||||||
|
*/
|
||||||
|
protected void assertComponentCursorCleared ()
|
||||||
|
{
|
||||||
|
if (_lastComp != null) {
|
||||||
|
Log.warning("In DnDManager, last component cursor not cleared.");
|
||||||
|
clearComponentCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void assertTopCursorCleared ()
|
||||||
|
{
|
||||||
|
if (_topComp != null) {
|
||||||
|
Log.warning("In DnDManager, top component cursor not cleared.");
|
||||||
|
_topComp.setCursor(_topCursor);
|
||||||
|
_topComp = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear out the component-level cursor.
|
* Clear out the component-level cursor.
|
||||||
*/
|
*/
|
||||||
@@ -216,7 +240,15 @@ public class DnDManager
|
|||||||
*/
|
*/
|
||||||
protected boolean isDragging ()
|
protected boolean isDragging ()
|
||||||
{
|
{
|
||||||
return (_source != null);
|
boolean dragging = (_source != null);
|
||||||
|
|
||||||
|
if (!dragging) {
|
||||||
|
// make sure there's no component/top cursor
|
||||||
|
assertComponentCursorCleared();
|
||||||
|
assertTopCursorCleared();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dragging;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user