2

Good day,

I have this view [extends JInternalFrame that has a controller [implements KeyListener]. On a method of mine, void loadListener() is where I added the KeyListener to the view.

At first focus of the frame, the KeyListener triggers its three methods. After changing the focus to another frame[another view, another controller] and returning to the first frame, the KeyListener won't trigger anymore.

How the focus of the KeyListener be triggered again after returning the focus to the frame having the KeyListener.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Cyril Horad
  • 1,555
  • 3
  • 23
  • 35

1 Answers1

1

Don't use a KeyListener. Swing was designed to use Key Bindings which will handle the focus problem easier.

camickr
  • 321,443
  • 19
  • 166
  • 288