Two Laptop Bag*
The moose likes Swing / AWT / SWT and the fly likes on mouse over Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "on mouse over" Watch "on mouse over" New topic
Author

on mouse over

ramesh kancherla
Ranch Hand

Joined: May 01, 2008
Posts: 124
i am implementing jtable.in my jtable i inserted icons into table cells.

i have to change icon when mouse pointer enter to icon.
i have to change icon when mouse pointer exited from icon.

i added mouselistener and i implemented mouse entered and exited methods.
i am finding row and columns through mouseevent.getPoint(),table.columnAtPoint(p),table.rowAtPoint(p) methods.

but i am getting -1 values to rows and columns.

can any one please tell me how can i solve my problem

Thanks & Regards
Ramesh k
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10355
    
    8

Originally posted by ramesh kancherla:

...i added mouselistener and i implemented mouse entered and exited methods...


Change it to MouseMotionListener and trap and process mouseMoved()


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ramesh kancherla
Ranch Hand

Joined: May 01, 2008
Posts: 124
i implemented mouse moved method. i am getting actual rows and column values
so it is working instead of mouse enter method.

but i have to implement mouse exited also.

how can i implement this.

can you please give me advice

Thanks & Regards
Ramesh K
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10355
    
    8

Originally posted by ramesh kancherla:

but i have to implement mouse exited also.


No you dont.
For every mouseMoved event, you need to figure out over which Icon the mouse is currently positioned. You change only that Icon. The rest of the Icons remain the same.
ramesh kancherla
Ranch Hand

Joined: May 01, 2008
Posts: 124
when mouse over on icon (mouse moved to icon) i am changing icon disable mode to icon enable mode. (i am inserting enable icon instead of disable icon)
if user select that icon then enabled icon is useful.
but if user not selected that icon i have to replace enable icon to disable icon when mouse exited from icon.

is it possible? can you please give me advice
how can i do it.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10355
    
    8

How about posting your existing code instead of theoretical discussions? Show us what you have and where is it going wrong.
ramesh kancherla
Ranch Hand

Joined: May 01, 2008
Posts: 124
Hi Maneesh Godbole

First Thanks you for responding quickly.

i got a output. i wrote logic inside mousemoved method. i have taken previous column and row also. when mouse is moved into cell,if i am calling with current rows and columns. it is working like as mouse entering method.
if i am calling with previous rows and columns. it is working like as mouse exited method. if i am calling both rows and columns it is working mouse entered and exited. it is working fine

Thanks & Regards
Ramesh K
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on mouse over