You have to add a keylistener to your component

public void addKeyListener(KeyListener keylistener)

with a line such as

mycomponent.addKeyListener(this);


--- Patrik_M�ller <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I have a problem with the KeyListener. It does not
> work. The
> System.out.println("xyz " + e) is never coming. Why?
> My Code is like this:
>
>
> package xy;
>
> import java.awt.*;
> import java.awt.event.*;
> import java.awt.GraphicsConfiguration;
>
> import javax.swing.*;
> import javax.swing.event.*;
> import javax.media.j3d.*;
> import javax.vecmath.*;
>
> import com.sun.j3d.utils.applet.MainFrame;
> import com.sun.j3d.utils.image.TextureLoader;
> import com.sun.j3d.utils.universe.*;
> import com.sun.j3d.utils.picking.behaviors.*;
> import com.sun.j3d.utils.behaviors.mouse.*;
> import com.sun.j3d.utils.picking.*;
>
>
>
> public class zzz extends JFrame implements
> KeyListener {
>
> ...
> ...
>
>  /**
>   * handles the events generated by pressing a key
>   */
>  public void keyPressed(KeyEvent e){
>    System.out.println("keyPressed " + e);
>
>  }
>
>  /**
>   * handles the events generated by typing a key
>   */
>  public void keyTyped(KeyEvent e) {
>   System.out.println("keyTyped " + e);
>  }
>
>
>  /**
>   * handles the events generated by releasing a key
>   */
>  public void keyReleased(KeyEvent e){
>   System.out.println("keyReleased " + e);
>  }
>
> } // end of class
>
>
>
>
>
>
>
>
> Patrik
>
>
>
> E-mail mailto: [EMAIL PROTECTED]
>
>
>
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to