Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6397316

Add "isLeftButton" to java.awt.event.MouseEvent

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P5
    • None
    • 6
    • client-libs
    • x86
    • linux

    Description

      A DESCRIPTION OF THE REQUEST :
      The current "javax.swing.SwingUtilities.isLeftMouseButton" method is implemented as below:

          public static boolean isLeftMouseButton(MouseEvent anEvent) {
               return ((anEvent.getModifiers() & InputEvent.BUTTON1_MASK) != 0);
          }

      Proposed "MouseEvent/isLeftButton" method:

          public boolean isLeftButton() {
               return ((getModifiers() & BUTTON1_MASK) != 0);
          }


      JUSTIFICATION :
      - "MouseEvent/isLeftButton" is more convenient than SwingUtilities.isLeftMouseButton
      - e.isLeftButton() is more natural than SwingUtilities.isLeftMouseButton(e)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      CODE:
      if (e.isLeftButton())...
      ACTUAL -
      CODE:
      import javax.swing.SwingUtilities;
      ...
      if (SwingUtilities.isLeftMouseButton(e))...

      Attachments

        Activity

          People

            dav Andrei Dmitriev (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: