..
>JWindow window= new JWindow();
Somebody asked recently, what good
was a JWiindow, over an undecorated JFrame,
and apparently, *not* for..
>window.addKeyListener(new KeyListener() {
..KeyListener! I expect it has something to do with
being keyboard focusable - put a text field in it, and
that may change it.
OTOH..
>What should I do if I want to catch the KEY type event in JWindow?
What about something that 'looks just like it'?
<sscce>
import javax.swing.JFrame;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
public class TestFocus {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setUndecorated(true);
f.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent e) {
System.out.println((int) e.getKeyChar());
}
public void keyReleased(KeyEvent e) {}
public void keyPressed(KeyEvent e) {}
});
System.out.println( "f.isFocusable() " + f.isFocusable() );
f.setSize(200,200);
f.setVisible(true);
}
}
</sscce>
HTH

Signature
Andrew Thompson
http://www.athompson.info/andrew/
JTL.zheng - 05 May 2007 06:32 GMT
haha, Thank you very much, Andrew T
your "something that 'looks just like it'" is exactly what I want!
: )
Andrew Thompson - 05 May 2007 06:42 GMT
..
>your "something that 'looks just like it'" is exactly what I want!
>: )
You're welcome. Glad to hear it is sorted. :-)

Signature
Andrew Thompson
http://www.athompson.info/andrew/