下面的代码,我是想实验一下。但为什么捕捉键盘的事件出不来呢?
这样捕捉键盘事件是正确的么?谢谢了!import java.awt.*;
import java.awt.event.*;
import javax.swing.*;public class SplashScreen2 extends JWindow {
private int duration;

public SplashScreen2() {
}

public void showSplash() {
JPanel content = (JPanel)getContentPane();
content.setBackground(Color.white);

//close the window when dragging
content.addMouseMotionListener(new MouseAdapter(){
public void mouseDragged(MouseEvent e){
System.out.println(e);
System.exit(0);
}
});
//show the clicked info
content.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
System.out.println(e);
}
});

//show the key event info
KeyStroke theEnter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,java.awt.event.InputEvent.SHIFT_DOWN_MASK,false);
ActionMap contentActionMap = content.getActionMap();
InputMap  contentInputMap  = content.getInputMap();
contentInputMap.put(theEnter,"Kind_of_Input");
contentActionMap.put("Kind_of_Input",new AbstractAction(){
public void actionPerformed(ActionEvent e){
System.out.println(e);
}
});
setBounds(500,500,400,200);
setVisible(true);
}

public static void main(String[] args) {
SplashScreen2 splash = new SplashScreen2();
splash.showSplash( );
}
}各位前辈,帮小弟看看了!