• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to change the cursor with onMouseOver...

 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my problem. I have a panel which has some lines drawn over it. I need to change the cursor to hand cursor when I move over the lines. I am able to set the cursor as handcursor for the total panel, but it should be changed when I move the mouse over the lines? Is there an event for mouse over? Please help me on this.

Ananth
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Line2D is a Shape and thus has certain properties that are quite useful. One of these is the intersect method, that can be used to see if the mouse intersects a line. You may have to translate the cursor point into a small square for this to work, but it does work.

 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply. I have got what I want like this,

getPsdGPanel().addMouseMotionListener(new java.awt.event.MouseMotionAdapter()
{
public void mouseMoved(MouseEvent e)
{
psdGPanelMouseMoved(e);
}
});

psdGPanelMouseMoved finds whether there is a line at that e.x and e.y and changes the cursor. Thanks again for your interest shown.

Ananth
 
Let me tell you a story about a man named Jed. He made this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic