I have strange situation: when I starting some java application on remote computer via Putty + Xming - and if JFrame
is setUndecorated(true)
- it can not gain focus again if it was lost:
jFrame.setUndecorated(true);
jFrame.addWindowFocusListener(new WindowFocusListener(){
@Override
public void windowGainedFocus(WindowEvent e) {
System.out.println("Window gained focus");
}
@Override
public void windowLostFocus(WindowEvent e) {
System.out.println("Window lost focus " + e.getOppositeWindow());//e.getOppositeWindow is null
}
});
When started - undecorated JFrame
receives focus, but if it is clicked somewhere - the focus is lost and the opposite window is null
. Then it never gain focus again. The problem do not exists if setUndecorated(false)
- when JFrame
is decorated.