1

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.

Ernestas Gruodis
  • 8,567
  • 14
  • 55
  • 117

1 Answers1

2

It's Xming software bug. Downloaded MobaXterm - and everything works fine now even with undecorated JFrames. Also tried Putty + X11 MobaXterm server - works good. That proves that Xming here is the problem.

Ernestas Gruodis
  • 8,567
  • 14
  • 55
  • 117