예제 #1
0
 void updateState(MouseEvent event) {
   if (isOld(event)) return;
   // childAt and locationOnScreenOf want the tree lock, so be careful not to use any additional
   // locks at the same time
   // to avoid deadlock.
   Point eventScreenLocation = null;
   // Determine the current mouse position in screen coordinates
   try {
     eventScreenLocation = locationOnScreenOf(event.getComponent());
   } catch (IllegalComponentStateException e) {
     // component might be hidden by the time we process this event
   } catch (UnexpectedException e) {
     if (!(e.getCause() instanceof IllegalComponentStateException)) throw e;
   }
   synchronized (this) {
     lastEventTime(event);
     dragDropInfo.update(event);
     mouseInfo.modifiers(modifiers);
     mouseInfo.update(event, eventScreenLocation);
     modifiers(mouseInfo.modifiers());
   }
 }
예제 #2
0
 public synchronized void clear() {
   mouseInfo.clear();
   dragDropInfo.clear();
   modifiers = 0;
   lastEventTime = 0;
 }
예제 #3
0
 /**
  * Indicates whether there is a native drag/drop operation in progress.
  *
  * @return <code>true</code> if there is a native drag/drop operation in progress, <code>false
  *     </code> otherwise.
  */
 public boolean isNativeDragActive() {
   return dragDropInfo.isNativeDragActive();
 }
예제 #4
0
 /**
  * Returns the coordinates where a drag operation started.
  *
  * @return the coordinates where a drag operation started.
  */
 public synchronized Point dragOrigin() {
   return dragDropInfo.origin();
 }
예제 #5
0
 /**
  * Returns the <code>{@link Component}</code> where a drag operation started.
  *
  * @return the <code>Component</code> where a drag operation started.
  */
 public synchronized Component dragSource() {
   return dragDropInfo.source();
 }
예제 #6
0
 /**
  * Indicates there is a drag operation in progress.
  *
  * @return <code>true</code> if there is a drag operation in progress, <code>false</code>
  *     otherwise.
  */
 public synchronized boolean dragInProgress() {
   return dragDropInfo.isDragging();
 }