Solved

Mouse on top of a JButton

Posted on 2007-03-26
8
301 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
Comment Utility
0
 
LVL 30

Accepted Solution

by:
mayankeagle earned 75 total points
Comment Utility
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
Comment Utility
prain, can you explain why i received no points, having given you the first correct answer?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Yes this should be a split.
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Notified Venabili, o' HG ;-)
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Thanks m :-)
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:-)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now