I’m working on a small application that handles finances and so on. The development environment i use is netbeans.
I have a methods-class (called Methoden) where I have stored all the methods, a data-class and the frame-class (called Fenster1)
To get some input I defined a method in the method-class and tried to access it with
Methoden m = new Methoden();
...
buttonAction {
m.getInput();
}
Code is fine, no errors at all. But when I try to start the application it takes a while and then this error appears:
Exception in thread “AWT-EventQueue-0” java.lang.StackOverflowError
at sun.awt.Win32GraphicsConfig.getBounds(Native Method)
at sun.awt.Win32GraphicsConfig.getBounds(Win32GraphicsConfig.java:222)
at java.awt.Window.init(Window.java:496)
at java.awt.Window.(Window.java:535)
at java.awt.Frame.(Frame.java:420)
at java.awt.Frame.(Frame.java:385)
at javax.swing.JFrame.(JFrame.java:180)
at haushaltsbuch.Fenster1.(Fenster1.java:19)
at haushaltsbuch.Methoden.(Methoden.java:16)
Now: how can I fix this error to make everything running fine?
seems resolved.
in Fenster1 there was Methoden m = new Methoden();
while in Methoden there was Fenster1 f = new Fenster1();
A stack overflow exception means (usually) that a function recursively calls itself. I would suspect Methoden#getInput() does this.