1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| private JTextField getTxtgouche() {
if (txtgouche == null) {
txtgouche = new JTextField();
txtgouche.setBounds(new java.awt.Rectangle(74,9,118,25));
txtgouche.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent e) {
// TODO Auto-generated Event stub keyPressed()
if (e.getKeyCode()==KeyEvent.VK_ENTER){
System.out.println("keyPressed()de enter lol");
// Ligne X
listeGouche.add(txtgouche.getText());
// Erreur de type la method add(String component) de type container ne sappliquer pas aux //arguments string
txtgouche.setText("");
}
}
});
}
return txtgouche;
} |
Partager