I would appreciate if someone can help me with the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at folder.ConfigTeclado.guardaConfig (ConfigTeclado.java:91)
The code (only the parts where I use it) is as follows:
public class ConfigTeclado extends JPanel implements ActionListener,KeyListener{
private Vector teclas = new Vector();
public void keyPressed(KeyEvent e){ }
public void keyReleased(KeyEvent e){
Boolean ver=true;
if(!ban){
for(int i=0;i<b.length && ver;i++){
if(b[i].getLabel().equals(e.getKeyText(e.getExtendedKeyCode())))
ver=false;
}
teclas.add(e.getKeyCode());
if(ver){
a.setLabel(e.getKeyText(e.getExtendedKeyCode()));
ban=true;
}
}
}
public void guardaConfig(){
bd.inicializar();
bd.actualizarConfiguracion("UP", (int)teclas.elementAt(0));
bd.actualizarConfiguracion("DOWN", (int)teclas.elementAt(1));
bd.actualizarConfiguracion("LEFT", (int)teclas.elementAt(2));
bd.actualizarConfiguracion("RIGHT", (int)teclas.elementAt(3));
bd.cerrar();
}
}
Thank you very much!