List of usage examples for javax.media.j3d Canvas3D addKeyListener
public synchronized void addKeyListener(KeyListener l)
From source file:BouncingBall.java
public BouncingBall() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D c = new Canvas3D(config); add("Center", c); c.addKeyListener(this); timer = new Timer(100, this); //timer.start(); Panel p = new Panel(); p.add(go);/*from www. j a v a2 s. c o m*/ add("North", p); go.addActionListener(this); go.addKeyListener(this); // Create a simple scene and attach it to the virtual universe BranchGroup scene = createSceneGraph(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene); }