I need help for my homework, please. Could someone tell me why there is always a "NullPointerException"?
I have altogether 5 classes but I only post the 2 important ones (GUI & InputDialog)
The "Main"-GUI shows all the students and when I click on the "Add..." button, the InputDialog appears. But when I click on "submit", there is a NullPointerException. Why? I used the ActionListener ... by the way :)
InputDialog-GUI:
import javax.swing.JButton;
import javax.swing.JTextField;
public class InputDialog extends javax.swing.JFrame {
public InputDialog() {
    initComponents();
    jButton1.addActionListener(new GUI(jButton1));
}
public String getTfGeburtsdatum() {
    return tfGeburtsdatum.getText();
}
public String getTfGeschlecht() {
    return tfGeschlecht.getText();
}
public String getTfKatalognummer() {
    return tfKatalognummer.getText();
}
public String getTfKlasse() {
    return tfKlasse.getText();
}
public String getTfNachname() {
    return tfNachname.getText();
}
public String getTfVorname() {
    return tfVorname.getText();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">                          
private void initComponents() {
    ...
"Main"-GUI:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
public class GUI extends javax.swing.JFrame implements ActionListener
{
private Model mod = new Model();
private Schueler sch;
private JButton button;
private InputDialog dia;
public GUI()
{
initComponents();
this.jList1.setComponentPopupMenu(this.jPopupMenu1);
this.showList();
}
public GUI(JButton button) {
    this.button = button;
}
private void initComponents() {
    ...
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{                                         
    dia = new InputDialog();
    dia.setVisible(true);
}                                        
private void showList()
{
FileBL bl = new FileBL();
bl.lesen();
mod = bl.getMod();
this.jList1.setModel(mod);
}
...
@Override
public void actionPerformed(ActionEvent ae) {
    if(ae.getSource() == button){
    String vn = dia.getTfVorname();
    String nn = dia.getTfNachname();
    String klasse = dia.getTfKlasse();
    String katalognummer = dia.getTfKatalognummer();
    String geschlecht = dia.getTfGeschlecht();
    String geburtsdatum = dia.getTfGeburtsdatum();
    SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
    Date gebDate = new Date();
    try {
        gebDate = sdf.parse(geburtsdatum);
    } catch (ParseException ex) {
        Logger.getLogger(InputDialog.class.getName()).log(Level.SEVERE, null, ex);
    }
    Schueler sch = new Schueler(vn,nn,klasse,katalognummer,geschlecht,gebDate);
    mod.add(sch);
    dia.setVisible(false);
    this.jList1.setModel(mod);
    }
}}
 
     
    