(please forgive me if this posts twice, it didn't show up on the list
the first time)

Can someone tell me what I'm doing wrong,(I want to "play" baseSound()
on
a key press)
... the  focus events work, but key events do not


public class NewWorld002 extends Applet implements KeyListener,
ActionListener, FocusListener
 {
............[snipped].............
  public void init()
   {
............[snipped].............
   frame.addFocusListener(this);
   frame.addKeyListener(this);
   frame.addWindowListener(new killAdapter());
   frame.setVisible(true);
   }
   public void focusGained(FocusEvent e)
  {
  baseSound.play();
  }
   public void focusLost(FocusEvent e)
  {
  baseSound.stop();
  }
 public void keyTyped(KeyEvent e)
    {
      }
   public void keyPressed(KeyEvent e)
  {
  baseSound.play();
  }
   public void keyReleased(KeyEvent e)
  {
  baseSound.stop();
  }




=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to