I am experiencing problems with unexpected focus loss from my 
components.

My interface contains a JList with a custom MouseListener. The 
JList contains items that themselves contain JTextFields. 
mouseClicked(), after some logic, may call requestFocus() on one 
of those JTextFields.

The requestFocus() is successful as verified by a successful 
hasFocus() call immediately after. It has also been verified by a 
FocusListener listening for focus changes on the JTextField in 
question - the JTextField definitely receives the keyboard focus.

However, immediately after listeners are notified and the 
hasFocus() completes, the component LOSES focus again 
(according to the FocusListener).

Here's the puzzling thing: all the focus listening tells me the 
JTextField has lost focus. There is no blinking cursor in the 
JTextField that would indicate focus. (I've played with all the caret 
position and visibility functions too - they don't help.) BUT, the 
JTextField still receives keystrokes! My DocumentListener is 
notified with correct text changes and it's fireContentsChanged()'ing 
just fine - which means that changes to the text in the JTextField 
repaint and show up in the GUI just fine. But there is NO blinking 
cursor and Swing insists the component does NOT have focus!

I am completely baffled. Can anyone shed some light on this?

- John Stoneham
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to