How to set backgound color of default panel from mouse event

This is a class assignment and I'm sorta stuck:
The following is a snippet from Panel class.   The assigment is to set the background color of the default panel to one color if the mouse enters over the panel and another upon it's exit.   I've identified the events but don't know how to reference the default content panel.

I'd appreciate any thoughts.

Thank you.

//****************************
// CirclePanel.java
//****************************
 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
 
public class CirclePanel extends JPanel {
 
    private final int WIDTH = 600,  HEIGHT = 400;
    private Circle circle;
 
    public CirclePanel() {
        // instantiate new object and add listeners
        // replaces addMouseListener(new CirclesListener());
        CirclesListener listener = new CirclesListener(); 
        addMouseListener(listener);
        addMouseMotionListener(listener);
 
        setPreferredSize(new Dimension(WIDTH, HEIGHT));
        
    }
 
...
    private class CirclesListener implements MouseListener, MouseMotionListener {
 
        public void mouseEntered(MouseEvent event) {
            // how to identify default content panel??
            // setBackground(Color.WHITE);
        }
 
        public void mouseExited(MouseEvent event) {
            // how to identify default content panel??
            // setBackground(Color.BLUE);
        }
    }
}

Open in new window

LVL 1
RichardKlineAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Your commented out code will work fine as part of an inner class of the JPanel
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
:-)
0
RichardKlineAuthor Commented:
yeah... story of my life.  Never, ever, Ever look for the easy way.   *sigh*

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.