Ask coding questions

← Back to all posts
MouseListeners in Java Swing are not Working
vedprad1 (906)

I am transferring some of my Java GUI files onto 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 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!