Example #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());
   }
 }
Example #2
0
 public synchronized void clear() {
   mouseInfo.clear();
   dragDropInfo.clear();
   modifiers = 0;
   lastEventTime = 0;
 }
Example #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();
 }
Example #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();
 }
Example #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();
 }
Example #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();
 }