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
Solved

Mouse on top of a JButton

Posted on 2007-03-26
8
324 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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.

856 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