classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: fix for javax.swing.plaf.basic.BasicButtonListener


From: Roman Kennke
Subject: [cp-patches] FYI: fix for javax.swing.plaf.basic.BasicButtonListener
Date: Wed, 20 Apr 2005 15:51:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

The class javax.swing.plaf.basic.BasicButtonListener relied on faulty behaviour in MouseEvent reporting. See https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=12748 for more details.

I have replaced the queries to getModifierEx in mousePressed and mouseReleased with queries to getModifiers.

2005-04-20  Roman Kennke  <address@hidden>

       * javax/swing/plaf/basic/BasicButtonListener.java
       (mousePressed): replaced query to getModifiersEx with getModifiers.
       This method relied on faulty behaviour in getModifierEx.
       (mouseReleased): replaced query to getModifiersEx with getModifiers.
       This method relied on faulty behaviour in getModifierEx.

/Roman

Index: javax/swing/plaf/basic/BasicButtonListener.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicButtonListener.java,v
retrieving revision 1.7
diff -u -r1.7 BasicButtonListener.java
--- javax/swing/plaf/basic/BasicButtonListener.java     23 Dec 2004 10:34:28 
-0000      1.7
+++ javax/swing/plaf/basic/BasicButtonListener.java     20 Apr 2005 13:46:14 
-0000
@@ -157,7 +157,7 @@
       {
         AbstractButton button = (AbstractButton) e.getSource();
         ButtonModel model = button.getModel();
-        if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0)
+        if (e.getButton() == MouseEvent.BUTTON1)
           {
             // It is important that these transitions happen in this order.
             model.setArmed(true);
@@ -179,7 +179,7 @@
       {
         AbstractButton button = (AbstractButton) e.getSource();
         ButtonModel model = button.getModel();
-        if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0)
+        if (e.getButton() == MouseEvent.BUTTON1)
           {
             // It is important that these transitions happen in this order.
             model.setPressed(false);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]