mouse over JMenubar


Hello there,

I have a Menu Bar which i want to change its apperance when i bring the mouse on it.how can i do that

cheers
zolf
zolfAsked:
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.

objectsCommented:
Try using a MouseMotionListener that changes the properties of the menu when mouse enters and leaves menu.
0
zolfAuthor Commented:

what is the method called which will indicate that the mouse button is on which menu
0
zolfAuthor Commented:

i mean in which class do i earch for this method
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Manikandan ThiagarajanSenior consultantCommented:
0
zolfAuthor Commented:

that example does not indicate that the mouse is over a menu
0
objectsCommented:
> what is the method called which will indicate that the mouse button is on which menu

u could try adding a listener to each JMenu, then thta listener would only be notified when mouse was over that menu.
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
zolfAuthor Commented:

the implements MouseMotionListener has two methods

public void mouseMoved(MouseEvent e)
     {
          
     }
     
     public void mouseDragged(MouseEvent e)
     {
          
     }

in my case i need to use mouseMoved(MouseEvent e)

i am new to swings.now what do next so the menu listens to mouse event.
0
zolfAuthor Commented:

i did this,is it correct

menuItem.addMouseListener(new MouseMotionAdapter(){
                     public void mouseMoved(MouseEvent e){
                           System.out.println(e);
                     }
               });
0
zolfAuthor Commented:


ignore the previous code.this is working but i want it to pop up,indicating it is over a perticular menu

menu.addMouseMotionListener(new MouseMotionAdapter(){
                     public void mouseMoved(MouseEvent e){
                           System.out.println(e);
                     }
               });
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
Java

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.