Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes an endless recursion in AWTEventMulticaster.mouseEntered()?

I've been doing JFrame for a little bit now, and ever since I started using Mouselistener (or any eventlistner for that matter) things would run smooth for about 2 mins or so. Then I would get a ton of repeating errors, the program would still run but I would be able to use any eventlistener. The error is basically this: ...

(couldn't catch top line in time, but something like Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError) (followed by)

at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
    at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:282)
...

repeating for hundreds of hundred of lines, where mouseEntered could be any of the eventlistners.

I've already spent alot of time going through at checking all integers to see if they go too high(found one, fixed it, still happens). I've also checked everywhere for a value that calls its self, but that doesn't make much sense because it happens like 2 mins into it.

I don't think is has to do with any specific code, just tell me what it means and how I could go about fixing it.

like image 878
Rex Avatar asked Jan 23 '26 15:01

Rex


2 Answers

I guess the most likely reason for this is that you have put a component into itself (either directly or indirectly).

like image 166
Hendrik Brummermann Avatar answered Jan 27 '26 00:01

Hendrik Brummermann


As noted above, you have a bug in your code pure and simple and until you show us this code, I doubt we can do anything other than guess. Having said that, my SWA-guess is that you're doing recursion, possibly unknowingly, perhaps by adding a MouseListener to a GUI component from within the MouseListener itself.

Regardless, do yourself and all of us a favor and show the pertinent code since most of us really don't like guessing.

like image 27
Hovercraft Full Of Eels Avatar answered Jan 27 '26 01:01

Hovercraft Full Of Eels



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!