Right- and Control-Drags on Mac OS X

Q: My Mac OS X Java application is not receiving drag actions when I start a drag using the Control key on a standard Apple mouse, or a right mouse button. Is this a bug?

A: This may seem like a problem with the Java implementation on Mac OS X, but it is in fact a platform difference that you need to be aware of as a developer. On Mac OS X, Control-clicking (or right-clicking, depending on your mouse) is the trigger for contextual menus. This is not unusual, but the platform difference is that the trigger occurs when the mouse is pressed, as opposed to released (the latter being the behavior on Windows). As soon as you press the left mouse button with the Control key held down, or press the right mouse button, the system recognizes it as a contextual menu trigger, never the beginning of a drag operation. This makes a Ctrl-drag (or right drag) impossible on Mac OS X. Note that this is for all environments: the Java AWT, built on top of Cocoa, simply inherits the behavior.

If your application supports multiple drag operations, we suggest first exhausting the other event masks (Alt/Option, Shift, Meta/Command) as well as combinations of those masks on Mac OS X. You can either do this conditionally for the Mac OS X platform (see Technical Note 2110), or make a conscious design decision for all platforms.

The popupTrigger issue described here, along with other differences that you may want to be aware of as a Mac OS X Java developer, is documented in the "Native Platform Integration: Making User Interface Decisions" section of Java 1.4 Development for Mac OS X. For more on how users can change the context of a drag on Mac OS X, please see the Drag and Drop section of the Apple Human Interface Guidelines.

Document Revision History

DateNotes
2005-06-29Minor editorial changes
2004-08-31Describes a difference in Drag and Drop on Mac OS X that affects all cross-platform Java applications

Posted: 2005-06-29


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.