Solved

Mouse on top of a JButton

Posted on 2007-03-26
8
330 Views
Last Modified: 2008-02-01
Ok I know this is an easy question. But....

I have a JButton. All I want to do is when the mouse is on top of the button, I want to popup a dialogBox, and when the mouse is outside the button, the dialogbox must be disposed. What is the event I have to trip for this?.
0
Comment
Question by:prain
  • 4
  • 3
8 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 50 total points
ID: 18795553
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 75 total points
ID: 18795592
mouseEntered and mouseExited () events are the ones you need to use. Add a MouseListener to your button.

button.addMouseListener ( new MouseAdapter () {
  public void mouseEntered ( MouseEvent me )
  {
    // do your stuff
  }
  public void mouseExited ( MouseEvent me )
  {
    // do your stuff
  }
} ) ;
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18795760
prain, can you explain why i received no points, having given you the first correct answer?
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 30

Expert Comment

by:Mayank S
ID: 18796695
Yes this should be a split.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18796704
Notified Venabili, o' HG ;-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18798310
Thanks m :-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18822552
:-)
0

Featured Post

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!

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

726 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