Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

on mouse over

 
ramesh kancherla
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
ramesh kancherla
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic