• 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

custom cursor in XOR mode

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using a custom crosshair cursor generated with a gif file containing the image. Is it possible that the cursor be shown in XOR mode, as can be seen in many graphics applications. i.e. the cursor (which is white in color) draws itsself in black wherever there is a white area on the panel.
Thanks in Advance
Amit
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm... Java doesn't support this behavior directly, as far as I know... but I think you could do it yourself. All you would have to do is set the "real" cursor to an invisible cursor, and draw the crosshairs on the frame yourself using XOR mode ( the Java Graphics object supports this... ), using a mouseListener to get the x and y coordinates of where it should be drawn.

Here's some code I was testing this concept on... hope it helps you out some...

( Note: "NoCursor.gif" is just a 16 x 16 transparent gif. )



-Nate
[This message has been edited by Nathan Pruett (edited June 28, 2001).]
 
Amit Agarwal
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nate,
Thanks for your help, but this will be difficult to implement in my application as my paint() method is very heavy, and i am looking forward to make minimum calls to it. If this method is used I will have to call the paint everytime the mouse moves to erase the previous cursor drawing.
Amit
 
reply
    Bookmark Topic Watch Topic
  • New Topic