folgender Quellcode:
So, wenn ich das Programm ausführe, bekomme ich folgende Fehlermeldung in einem Popupfenster:
"Fatal exception occured. Program will exit."
So, was stimmt bei mir jetzt nicht?
Java:
import javax.swing.*;
import java.awt.event.*;
public class UI extends JFrame {
public UI() {
setLayout(null);
setTitle("Mariosweeper");
setBounds(0, 0, 650, 370);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JLabel l = new JLabel("Schwierigkeitsgrad wählen!");
l.setBounds(0, 0, 158, 15);
add(l);
JButton easyButton = new JButton("leicht");
JButton normalButton = new JButton("mittel");
JButton hardButton = new JButton("schwer");
easyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Main.setDifficulty(1);
}
});
normalButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Main.setDifficulty(2);
}
});
hardButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Main.setDifficulty(3);
}
});
easyButton.setBounds(0, 30, 50, 30);
normalButton.setBounds(65, 30, 50, 30);
hardButton.setBounds(130, 30, 50, 30);
add(easyButton);
add(normalButton);
add(hardButton);
setVisible(true);
}
}
"Fatal exception occured. Program will exit."
So, was stimmt bei mir jetzt nicht?
Zuletzt bearbeitet: