In my apllication i am using a jpanel in which i want to add a key listener. I did it. But it doesnot work.
Is it because i am using a swingworker to update the contents of the panel every second.
Here is my code to update the panel
RenderedImage image = ImageIO.read(new ByteArrayInputStream((byte[]) get()));
Graphics graphics = remote.rdpanel.getGraphics();
if (graphics != null) {
Image readyImage = new ImageIcon(UtilityFunctions.convertRenderedImage(image)).getImage();
graphics.drawImage(readyImage, 0, 0, remote.rdpanel.getWidth(), remote.rdpanel.getHeight(), null);
}