Hello freinds! I am developing a game & a problem occur with pressing the keys
the class name is game it extends JPanel, when I register keylistener by writing addKeyListener( this); in the constructer game(),it's not working but when I extends JFrame it starts working & my problem is I have to extends JPanel ,so how can I solve it.....
Here is the code
import javax.swing.*;
public class Game extends JPanel
{
public BufferedImage image,buffer;
public Game(BufferedIm age image)
{
this.image=imag e;
the class name is game it extends JPanel, when I register keylistener by writing addKeyListener( this); in the constructer game(),it's not working but when I extends JFrame it starts working & my problem is I have to extends JPanel ,so how can I solve it.....
Here is the code
import javax.swing.*;
public class Game extends JPanel
{
public BufferedImage image,buffer;
public Game(BufferedIm age image)
{
this.image=imag e;
Comment