The following code does not seem to work:
public class DocumentSetupDialog extends JInternalFrame {
public DocumentSetupDialog {
addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
System.out.println("hello");
}
});
}
}
Neither does getGlassPane().addKeyListener()
How do I pick up key events in JInternalFrames?
Thanks,
Ron
zero - 22 Nov 2005 20:25 GMT
"Ron" <roninabox@gmail.com> wrote in news:1132633221.618643.56110
@g43g2000cwa.googlegroups.com:
> The following code does not seem to work:
>
[quoted text clipped - 14 lines]
> Thanks,
> Ron
I haven't tried this, but I read somewhere that you should add the
KeyListener to the DesktopPane, and in the keyPressed method use
getSelectedFrame to see which JInternalFrame has the focus.
Ron - 23 Nov 2005 13:25 GMT
You know, this isn't working for a JDialog either.
Michael Dunn - 23 Nov 2005 18:24 GMT
> The following code does not seem to work:
>
[quoted text clipped - 14 lines]
> Thanks,
> Ron
add this line
public DocumentSetupDialog {
setFocusable(true);//<----------------------------
addKeyListener(new KeyAdapter() {
Ron - 23 Nov 2005 21:01 GMT