Ciao ragazzi...
Qualcuno sa spiegarmi perchè sull'istruzione:
combo_chiavi.addItem("kkk");
Ottengo un nullpointerexception?
/*
* Ricerca.java
*
* Created on 4 novembre 2005, 22.55
*/
/**
*
* @author magnus
*/
public class Ricerca extends javax.swing.JFrame {
/** Creates new form Ricerca */
public Ricerca(String chiavi[]) {
combo_chiavi.addItem("kkk");
/*for (int j=0;j<chiavi.length;j++){
// c_chiavi.addItem("kkk");
}*/
initComponents();
}
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
combo_chiavi = new javax.swing.JComboBox();
jButton1 = new javax.swing.JButton();
getContentPane().setLayout(null);
setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
jLabel1.setText("Chiave di Ricerca:");
getContentPane().add(jLabel1);
jLabel1.setBounds(20, 20, 110, 15);
combo_chiavi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
combo_chiaviActionPerformed(evt);
}
});
getContentPane().add(combo_chiavi);
combo_chiavi.setBounds(120, 20, 190, 19);
jButton1.setText("jButton1");
getContentPane().add(jButton1);
jButton1.setBounds(240, 50, 71, 23);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize ();
setBounds((screenSize.width-400)/2, (screenSize.height-300)/2, 400, 300);
}
// </editor-fold>
private void combo_chiaviActionPerformed(java.awt.event.ActionE vent evt) {
// TODO add your handling code here:
}
// Variables declaration - do not modify
private javax.swing.JComboBox combo_chiavi;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
// End of variables declaration
}