NYassuki
NYassuki

Reputation: 23

Global event listener JAVA

I want to listen keyboard event over all control in my jframe to show new window, so far this is my code :

KeyboardFocusManager.getCurrentKeyboardFocusManager()
                .addKeyEventDispatcher(new KeyEventDispatcher() {
                    @Override
                    public boolean dispatchKeyEvent(KeyEvent evt) {
                      int key = evt.getKeyCode();
                         if (evt.isControlDown() && key == KeyEvent.VK_F1) {

                           JManualTransction FrmManual = new JManualTransaksi();  
                           FrmManual.SetVisible(true);  

                          }
                        return false;
                    }
            });

But the problem is the FrmManual window is always show twice when i press CTRL + F1 May somebody can tell me why?

thanks ....

Upvotes: 0

Views: 361

Answers (0)

Related Questions