Skip to content
Sign upLog in
← Back to Community

MouseListeners in Java Swing are not Working

Profile icon
vedprad1

I am transferring some of my Java GUI files onto repl.it. I noticed that when I tried to run this program, the progrma would not respond to my mouse and keys. Couls anybody help me find my mistake? Is it a repl.it problem?

The point of the program is to have a garden (a rectangle) that is pink. If you click inside the garden and press '%', the garden will be watered (the rectangle will turn green). Then, if you click inside the garden again and press the up arrow, you will add sun, and flowers (circles) will start to appear. At anytime, if you click space, the garden will revert to the original.

I would appreciate any help. Thanks!

Voters
Profile icon
Coder100
Profile icon
VedangPradhan
Profile icon
AAnonymity
Profile icon
vedprad1