I have one frame containing panel with 4 JTextField component. I set focus to second textfield and show glasspane. After some time(long operation was finished) I hide glasspane (setVisible(false)) but first textfield has focus instead of second one.
Can somebody tell me how to simple achieve that second one will be focuced as before?
I tried to implement focusGained and focusLost events in my glasspane to store last focused component (e.getCompossiteComponent) but i don't know if it's good idea.
something like this:
public void focusGained(FocusEvent e)
this.lastFocused = e.getCompossiteComponent()
public void focusLost(FocusEvent e)
My glasspane can be later extended with additional components (possible to gain focus also) and I don't know if such is enough or not.
Does better way exist to focus corrent textfield on my panel?