I have a JInternalFrame and i want to call another JInternalFrame when i press F1 in a JTextField, however i'm getting NullPointerException. This is my code
GUI:
jLabel2.setText("ID:");
getContentPane().add(jLabel2);
jLabel2.setBounds(10, 240, 15, 25);
getContentPane().add(jTextField11);
jTextField11.setBounds(30, 240, 70, 25);
jTextField11.addKeyListener(this);
KeyEvent:
public void keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
if( arg0.getKeyCode() == KeyEvent.VK_F1 ){
listProducto.setVisible(true);******ERROR******
Main.getInstance().getPortada().getDesktop().add(listProducto);
Main.getInstance().getPortada().getDesktop()
.moveToFront(listProducto);
try {
listProducto.setSelected(true);
} catch (PropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}