Search code examples
javajoglkey-bindingsglcanvas

Key Bindings with JOGL GLCanvas (java)


Just curious, how would you use key bindings with the openGL GLCanvas? I understand how to use them with JPanel (which applies to GLPanel) but is it possible to use it with GLCanvas? How would you do it if it is possible?

-Dan


Solution

  • (OK, I just now looked up the GLCanvas API)
    Q: What does GLCanvas extend?
    A: Canvas, an AWT component.

    Q: Does AWT have key bindings?
    A: No. So the overall answer is you can't use Key Bindings directly with GLCanvas.

    Perhaps it can be used indirectly by attaching the bindings to another Swing component in the same GUI.