Hi
I get the following errors when I changed something - I don't know what, but these occur now.
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at sun.awt.Win32GraphicsConfig.getBounds(Native Method)
at sun.awt.Win32GraphicsConfig.getBounds(Win32GraphicsConfig.java:240)
at java.awt.Window.init(Window.java:368)
at java.awt.Window.<init>(Window.java:407)
at java.awt.Frame.<init>(Frame.java:402)
at java.awt.Frame.<init>(Frame.java:367)
at javax.swing.JFrame.<init>(JFrame.java:163)
at ExitJoke.<init>(ExitJoke.java:22)
at ExitJoke.<init>(ExitJoke.java:43) <-- Keeps repeating itself over and over
I had changed something, because befor I did it would keep repeating the exit screen without stopping, then eventually freezing the computer because some many screens were open at once. Here's the code.
import java.util.Timer;
import java.util.TimerTask;
/**
*
* @author Mike
*/
public class ExitJoke extends javax.swing.JFrame {
Timer timer;
public ExitJoke ( int seconds ) {
timer = new Timer ( ) ;
timer.schedule ( new RemindTask ( ) , seconds*1000 ) ;
}
class RemindTask extends TimerTask {
public void run ( ) {
timer.cancel ( ) ; //Terminate the timer thread
}
}
{
new ExitJoke ( 5 ) ;//Time in seconds.
System.exit(0);
}
/** Creates new form ExitJoke */
public ExitJoke() {
initComponents();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ExitJoke().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnJoke;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
I didn't include the 'Generated Code' as I have not touched it, and its very long :P