[Schmitzm-commits] r647 - branches/2.0-RC2/src/schmitzm/swing/event

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 28 17:50:51 CET 2010


Author: mojays
Date: 2010-01-28 17:50:51 +0100 (Thu, 28 Jan 2010)
New Revision: 647

Modified:
   branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java
Log:


Modified: branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java	2010-01-28 16:47:13 UTC (rev 646)
+++ branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java	2010-01-28 16:50:51 UTC (rev 647)
@@ -44,6 +44,8 @@
 public class SelectiveMouseAdapter extends MouseAdapter {
   /** Holds the activation of the several {@link MouseInputType MouseInputTypes}. */
   protected Map<MouseInputType, Boolean> activationMap = new HashMap<MouseInputType, Boolean>();
+  /** Holds the button the drag is performed with. */
+  protected int dragButton = MouseEvent.NOBUTTON;
   /** Holds the window position a drag is started on. */
   protected Point dragStartPos = null;
   /** Holds the window position of last {@link #mouseDragged(MouseEvent)}
@@ -94,6 +96,16 @@
   }
 
   /**
+   * Returns the button a drag is performed with.<br>
+   * <b>Note:</b> This method only returns the button DURING a drag.
+   * If no drag is performed {@link MouseEvent#NOBUTTON} is returned!
+   * call.
+   */
+  public int getDragButton() {
+    return dragButton;
+  }
+
+  /**
    * Calls {@link #performMouseClicked(MouseEvent)} if the mouse
    * action is enabled for the click.<br>
    * For actions which can not be specified by {@link MouseInputType} (e.g. 3rd
@@ -162,6 +174,7 @@
   public final void mousePressed(MouseEvent e) {
     dragStartPos = e.getPoint();
     dragLastPos  = null;
+    dragButton   = e.getButton();
     if ( isMouseClickEnabled(e) )
       performMousePressed(e);
   }
@@ -194,6 +207,7 @@
   
     dragStartPos = null;
     dragLastPos  = null;
+    dragButton   = MouseEvent.NOBUTTON;
   }
 
   /**



More information about the Schmitzm-commits mailing list