G
Guest
Gast
Hallo,k
warum bekomme ich hier eine Nullpointer exception in Zeile 63??
warum bekomme ich hier eine Nullpointer exception in Zeile 63??
Code:
import java.awt.Button;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class Fenster extends Frame{
TextField text;
Button b;
Runner runner;
public Fenster(){
runner= new Runner();
this.text= new TextField();
this.setTitle("Threadfensteranwendung");
this.setLayout(new GridLayout());
this.setSize(400,300);
this.addWindowListener(new WindowListener(){
public void windowActivated(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
}
public void windowClosed(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
}
public void windowClosing(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
System.exit(0);
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
}
public void windowIconified(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
}
public void windowOpened(WindowEvent arg0) {
// TODO Automatisch erstellter Methoden-Stub
}
});
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
runner.setTextfield(text);
runner.start();
}
});
this.add(this.text);
this.add(this.b);
this.setVisible(true);
}
}