hi all
i made a jinternalframe and registered keylistener when a key is pressed it should print the
key code but it doesnot print the key code. please tell me what is wrong my code is given below
===================
import javax.swing.*;
import java.awt.*;
import javax.swing.table.* ;
import java.util.*;
import java.sql.*;
import java.awt.event.*;
public class AddContractor extends JInternalFrame implements KeyListener
{
public AddContractor()
{
super("|Contractor|" , true , true , true , true);
try{
setSize(463 , 450);
setLocation(260 , 140);
jbInit();
}catch(Exception e)
{
e.printStackTrace();
}
} //close of addproject const
private void jbInit() throws Exception
{
this.getContentPane().setLayout(null);
this.getContentPane().setBackground(new Color(71, 97, 142));
addKeyListener(this);
this.setVisible(true);
}
public void keyPressed(KeyEvent ke)
{
System.out.print(ke.getKeyCode());
}
public void keyReleased(KeyEvent kre){
System.out.println(kre.getKeyCode() );
}
public void keyTyped(KeyEvent kety){
System.out.println(kety.getKeyCode() );
}
}