?
Solved

mouse over JMenubar

Posted on 2006-04-11
9
Medium Priority
?
221 Views
Last Modified: 2010-03-31

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
0
Comment
Question by:zolf
  • 6
  • 2
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16433330
Try using a MouseMotionListener that changes the properties of the menu when mouse enters and leaves menu.
0
 

Author Comment

by:zolf
ID: 16433345

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

Author Comment

by:zolf
ID: 16433354

i mean in which class do i earch for this method
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Manikandan Thiagarajan
ID: 16433434
0
 

Author Comment

by:zolf
ID: 16433466

that example does not indicate that the mouse is over a menu
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 16433526
> 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
 

Author Comment

by:zolf
ID: 16433578

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
 

Author Comment

by:zolf
ID: 16433590

i did this,is it correct

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

Author Comment

by:zolf
ID: 16433618


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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question