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
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).]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: May 09, 2001
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