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

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

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      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

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: