How to add KeyListener to JDialog
۱۲ ۱۰ ۱۳۸۶You can add KeyListener to your JDialog component as you can add it to any other swing components but when you add other components to JDialog, they eat key events.
To solve this problem you should register KeyboardAction for JDialog. In below code snippet typically I want sense F1 key pressing to do something:
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
};
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
JRootPane rootPane = getRootPane();
rootPane.registerKeyboardAction(actionListener, keyStroke,JComponent.WHEN_IN_FOCUSED_WINDOW);





با سلام
کتاب
Java how to program
دارای ادیشن هفتم نیز می باشد
من خیلی دنبال جایی برای دانلود اون گشتم
ولی چیزی پیدا نکردم
ممنون میشم اگه اون رو تو سایتتون قرار بدین