Solved

Mouse on top of a JButton

Posted on 2007-03-26
8
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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.

688 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