[kaffe] Bug report: MouseListeners, getComponentAt

Dalibor Topic robilad at yahoo.com
Tue Feb 18 03:14:01 PST 2003


hi David,

thanks for the bug report. I've looked into it and
created an updated version of the test (attached).

It seems to show (among other things ;), that kaffe's
AWT event handling sometimes can't decide properly
which event propagation model to use: the one from jdk
1.0 (propagate up the component tree untill someone
handles it), or the one from jdk 1.1 (events are
handled at component tree leaves). 

So if you run the updated test on  JDK 1.1 and click
on the button, you should see a 'clicked' message,
while clicking on other  leaves of the component tree
will result in no message, because jdk 1.1 uses the
1.1 event model to (not) propagate the event up to the
frame.

topic at clerks:~/bugs/novalis>
/usr/lib/j2sdk1.4.1_01/bin/java DemoPanelBug
enabled: true
DemoPanelBug[frame0,0,0,50x88,layout=java.awt.GridLayout,title=,resizable,normal]
java.awt.Canvas[canvas0,5,25,25x29]
java.awt.Label[label0,30,25,25x29,align=left,text=a]
java.awt.Button[button0,5,54,25x29,label=b]
java.awt.Panel[panel0,30,54,25x29,layout=java.awt.FlowLayout]
event:
java.awt.event.MouseEvent[MOUSE_CLICKED,(9,10),button=1,modifiers=Button1,clickCount=1]
on button0
Clicked
DemoPanelBug[frame0,0,0,50x88,layout=java.awt.GridLayout,title=,resizable,normal]
at java.awt.Point[x=9,y=10]

If you run the updated test on kaffe, you'll notice
that it propagates the event unless it's been handled
by the component, which is the jdk 1.0 model.

topic at clerks:~/bugs/novalis>
~/kaffe-sound-shared/bin/java DemoPanelBug
enabled: true
DemoPanelBug[frame0,0,0,96x124,layout=java.awt.GridLayout,resizable,title=]
java.awt.Canvas[canvas0,0,22,48x47]
java.awt.Label[null,48,22,48x47,Label: a]
java.awt.Button[null,0,69,48x47,Label: b]
java.awt.Panel[panel0,48,69,48x47,layout=java.awt.FlowLayout]
event:
java.awt.MouseEvt[MOUSE_CLICKED,(68,43),mods=16,clickCount=1]
on frame0
Clicked java.awt.Label[null,48,22,48x47,Label: a] at
java.awt.Point[x=68,y=43]
event:
java.awt.MouseEvt[MOUSE_CLICKED,(22,44),mods=16,clickCount=1]
on frame0
Clicked java.awt.Canvas[canvas0,0,22,48x47] at
java.awt.Point[x=22,y=44]
event:
java.awt.MouseEvt[MOUSE_CLICKED,(76,95),mods=16,clickCount=1]
on frame0
Clicked
java.awt.Panel[panel0,48,69,48x47,layout=java.awt.FlowLayout]
at java.awt.Point[x=76,y=95]
event:
java.awt.MouseEvt[MOUSE_CLICKED,(25,28),mods=16,clickCount=1]
on java.awt.Button
Clicked java.awt.Canvas[canvas0,0,22,48x47] at
java.awt.Point[x=25,y=28]

I'll first have to fix the toString methods of the
classes involved, though. You could try to take a look
at the event propagation in kaffe's
java.awt.Component.java, Button.java etc. and try to
find out why it's using the inappropriate event
handling model. Of course, pointers to documentation
describing when one should pick which event
propagation model are welcome, too, as I find the docs
on that from Sun somewhat lacking ;)

cheers,
dalibor topic

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com




More information about the kaffe mailing list