Bonjour

J'utilise JOGL dans mon application. Je voudrais implémenter un KeyListener pour manipuler au clavier ma visualisation.
Voici succinctement le code de ma classe pour la visualisation:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
public class NetworkRenderer implements GLEventListener, MouseListener, MouseMotionListener, MouseWheelListener, KeyListener {
 
    public void init(GLAutoDrawable arg0) {
        this.gl = arg0.getGL();
        gl.glShadeModel(GL.GL_SMOOTH); // Enable Smooth Shading
        gl.glClearColor(1f, 1f, 1f, 1f);
        gl.glClearDepth(1.0f);
        arg0.addMouseListener(this);
        arg0.addMouseMotionListener(this);
        arg0.addMouseWheelListener(this);
        arg0.addKeyListener(this);
    }
 
    public void display(GLAutoDrawable arg0) {
        this.gl = arg0.getGL();
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
 
        if (this.point != null) {
            pickPoint(gl);
        }
 
        drawWorld(gl, GL.GL_RENDER);
 
        gl.glFlush();
    }
 
    public void keyTyped(KeyEvent arg0) {
        System.out.println(arg0);
    }
 
    public void keyPressed(KeyEvent arg0) {
        System.out.println(arg0);
    }
 
    public void keyReleased(KeyEvent arg0) {
        System.out.println(arg0);
    }
 
}
Et voici comment je construis cet élément dans ma fenêtre principale:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
    private void changeGLJPanel(CompleteGraph cg) {
        Date start = new Date();
        this.gljPanel.removeGLEventListener(this.glel);
        this.mainPanel.remove(0);
        this.gljPanel = null;
        this.glel = null;
        this.jScrollPane = null;
        System.gc();
        this.gljPanel = new GLJPanel();
        animator = new Animator(gljPanel);
        glel = new NetworkRenderer(cg, animator, this);
        gljPanel.addGLEventListener(glel);
        gljPanel.setFocusable(true);
        /*KeyListener kl = (KeyListener)glel;
        gljPanel.addKeyListener(kl);*/
        //this.jScrollPane = new JScrollPane(this.gljPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        //this.mainPanel.add(this.jScrollPane, BorderLayout.CENTER);
        this.mainPanel.add(this.gljPanel, BorderLayout.CENTER);
        this.mainPanel.updateUI();
        Date end = new Date();
        long time = end.getTime()-start.getTime();
        System.out.println("Displaying time: "+time+" ms");
    }
Le problème est que rien ne se passe lorsque je tape sur le clavier.
J'ai manqué quelque chose ? Je précise que j'ai implémenter dans ma classe NetworkRenderer mes listeners avec la souris et tout fonctionne. J'ai choisi de ne pas les afficher ici.
Merci d'avance.

@++