Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2007, 10:14 PM
Member
 
Join Date: Apr 2007
Location: Pennsylvania,USA
Posts: 46
sandor is on a distinguished road
Mouse over JButton
I have an 10 x 10 array of JButtons in my project. I was just wondering how do i find out which button the mouse cursor is over at any given time?
I have tried adding the following to the buttons:
Code:
b.addMouseMotionListener(new MouseMovingHandler()); b.addMouseListener(new MouseHandler());
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-17-2007, 10:15 PM
Member
 
Join Date: Apr 2007
Location: USA
Posts: 50
derrickD is on a distinguished road
You can try to use the mouseEntered method in MouseListener and you can try to get the X and Y coordinates from the mouse and check which button it is on. Which would be getX and getY from the MouseEvent.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse dragg not working Preethi AWT / Swing 1 02-08-2008 05:51 AM
The mouse and the cheese Don Quixote Java 2D 4 08-15-2007 11:55 PM
How to mouse-drag a JWindow? cruxblack New To Java 3 08-06-2007 10:52 AM
mouse over on JButton gradon Java Applets 1 08-04-2007 06:50 AM
Use the mouse position susan Java Applets 1 07-29-2007 12:10 AM


All times are GMT +3. The time now is 03:24 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org