cs_blat
Messages postés102Date d'inscriptionlundi 23 décembre 2002StatutMembreDernière intervention 5 juin 2007
-
3 déc. 2005 à 17:57
Twinuts
Messages postés5375Date d'inscriptiondimanche 4 mai 2003StatutModérateurDernière intervention14 juin 2023
-
10 déc. 2005 à 17:07
Bonjour,
Voila mon pb en détail :
J'ai une JFrame dans laquelle j'ai mis un KeyListener et un JPanel. Sur
ce dernier, il y a un autre JPanel. Jusque la ca marche très bien. Mais
si j'ajoute autre chose sur mon panel principal, le KeyListener
disparait....
JPanel principal = new JPanel();
this.setContentPane(principal);
principal.setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(5, 165, 800, 600);
principal.add(panel);
this.addKeyListener(new KeyListener() {
//...
});
OK mais si je rajoute : principal.add(new JButton()); ou qqch d'équivalent je n'ai plus aucune action sur mon clavier...
Et là j'avoue que je comprend pas donc si qq'un pouvait éclairer mes lanternes, ce serait super...