Capture d'évenement imposible sur JTextField
Voilà, après implémentation d'un zone de texte j'ai voulu capture les évènements du clavier, mais aucune réaction.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
public JPanel createClientMoralPanel(){
JPanel p = new JPanel();
p.setLayout(null);
p.setPreferredSize(new Dimension(540, 260));
txtRef = new JlblTextField("Nr client", 10);
txtRef.setLocation(10, 10);
txtRef.setSize(new Dimension(100,40));
KeyAdapter c = new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
System.out.println("key Typed");
}
};
txtRef.addKeyListener(c);
p.add(txtRef); |
Les solutions sont les bien venues :)