[4868] in java-interest
Mouse evetns problem
daemon@ATHENA.MIT.EDU (Gil Bregman)
Wed Jan 17 05:58:21 1996
Date: Wed, 17 Jan 1996 11:34:52 +0200 (IST)
From: Gil Bregman <gil.bregman@applicom.co.il>
To: Java Interest Mailing List <java-interest@java.sun.com>
Hi,
I'm developing a Java application where I need to parse key
press/release and mouse up/down events. I have two problems:
1) There is no way to get an event when a key like "SHIFT" or "ALT" is
pressed, only when another key will be pressed I'll get the information,
in the "modifiers" field. I would have preferred a mechanism like in X
events, where you get both the event for the "SHIFT" press and the
modifiers info with the next key press.
2) More importantly, there is no way to deduce the exact physical event.
The button which was pressed is put into the "modifiers" field.
Experimenting a bit, I found that the left button has a "0" value, the
middle button has an "8" value and the right button has a "4" value.
Those values are order together in case of more then button is pressed.
There are two problems with that:
- You can't always tell that the left button is pressed. There is
no way to distinguish between "middle button is pressed" and "both
left and middle button are pressed". You can't use a value of "0"
when you OR bits together.
- The masks of the button overlap those of the keyboard modifier
keys. You can't tell if the "ALT" key, for example, was pressed
or the equivalent button was pressed.
There a lot of applications who relies on more complex mouse/keyboard
combinations. I think the event class should either use distinct,
non-zero, masks for each button and modifier key, or use two different
fields (like the key events which use the "key" field on top of the
"modifiers" field).
Gil Bregman
-----------------------------------------------------------------------------
Gil Bregman Applicom Systems, Ltd.
Email : Gil.Bregman@applicom.co.il 39 Ha-Galim Boulevard
Phone : +972-9-598-679 Merkazim Building 2001
Fax : +972-9-598-990 Herzliya 46725
WWW: http://www.applicom.co.il/~gil ISRAEL
-----------------------------------------------------------------------------
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com