Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mouseEntered events

Status
Not open for further replies.

Josh42

Programmer
Dec 22, 2000
7
US
Hi all. I need some help with "mouseEntered" events. It says that it generates an event when the cursor enters a Component. Well, how do I create that component? Thank you.

Josh Ciolkosz
 
Hi.

There is no particular way to create your Component. You just have to add a MouseListener to your Component.

For example :

{
java.awt.Button b = new java.awt.Button ("Eho");

...

b.addMouseListener (new MouseListener ()
{
public void mouseEntered(MouseEvent e)
{
//Your handling code goes here
}
});
}

Hope this will help.

Bye.
 
I guess I am not sure what a Component is exactly. If I want to designate an area where a mouseEntered event would occur, don't I somehow have to define the limits of that area (say, in pixels or something?) I'm sorta making a tic-tac-toe game and I need the computer to know when it enters a box. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top