Focus bug

Kero van Gelder kero at
Sat Mar 24 10:09:46 PST 2001

Hi all,

I have a Frame that contains a Canvas, two Scrollbar's and a Label. 
When I create the Frame, I let the Canvas request focus. It gets it.
However, whenever focus is lost to the Frame, the Canvas does not
receive focus back again.

This is due to the fact that when the mentioned Frame receives the
focus, it calls focusNext() (via some ShortcutHandler). Neither of my
four Components are focus-traversable, so none of them gets focus.

What I would expect is that the Component that has the focus, is
remembered in some way when the Frame loses focus, such that the
Component can receive it back whenever the Frame receives it back.

I tried to remember the Component in the Frame, but got caught in
Components that never show they gain focus in the Java part. A peek in
the C-code showed code involved in focus there, too and that is when
I gave up.

Remark: Component.processFocusEvent() tests whether there is a
FocusListener, but when there was none, the function did not get
called at all.


PS: other JVM's have better behaviour, but not perfect either.
PS2: I have a simple work-around.

+--- Kero --------------------------------- kero at ---+
|  Don't split your mentality without thinking twice       |
|                          Proud like a God -- Guano Apes  |
+--- M38c ------------------ ---+

More information about the kaffe mailing list