[3692] in java-interest
Re: Button subclassing
daemon@ATHENA.MIT.EDU (Gary Aitken)
Wed Nov 22 11:35:08 1995
Date: Mon, 20 Nov 1995 00:54:14 -0700
From: garya@village.org (Gary Aitken)
To: Ken Root <Ken_Root@ccm.jf.intel.com>, java-interest@java.sun.com
I didn't see an answer to this, and I'm not much help...
> I need to handle MouseDown and MouseUp events separately in a button
> but even with subclassing the button class, all I get is the event
> when the button is released.
>
> Any clues, tips, or examples on how to do this?
MouseDown and MouseUp are siphoned off by the native toolkit object.
It appears that the java event delivery mechanism is not good at delivering
events to subclasses when those events are processed by the underlying
native toolkit object (this is the second problem like this I've seen; the
other one involved TextArea and keyboard events).
I tried overriding deliverEvent and postEvent, as well as handleEvent,
to no avail; the only event which gets delivered is the misc ACTION_EVENT,
which happens when the native toolkit is all done. Looking at the code, you
would expect an override of postEvent to be needed to make it work, since
Component.postEvent() gives preference to the peer (native toolkit object),
instead of letting handleEvent do this. Unfortunately, that is not sufficient.
Interestingly enough, when the ACTION_EVENT event comes in, it comes in to
postEvent, not deliverEvent, indicating it is getting delivered via some
mechanism other than the one you would expect.
Does anyone know how to intercept events normally processed by the native
toolkit object? Arthur? Sami?
Gary Aitken garya@village.org
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com