Problem with Cursor Type


#1

Hi,
I use setMouseCursor to use a crossHairCurosor but its displaying the crosshairCursor only in current component , but not in whole desktop.
What changes needed to get it through out the desktop.


#2

Yes, that’s exactly what it’s supposed to do.

You can’t set a global cursor, because that’ll depend on whatever application your mouse cursor moves over. What are you actually trying to do?


#3

Hi Jules,
I am using a color picker inside an app. My requirement is if i click a button , which is placed inside the colour picker dialog. , the cursor need to change to crossHair type. But this croosHair type is coming only inside the Colout Picker dialog, not in My app or window.


#4

Oh, I see, so you want to be able to click on any pixel on the whole screen?

Well yes, a global mouse listener should do the trick. You’re probably just not using the callback correctly or something. Hard to tell from just a vague description.

Not sure about the cursor thing though. The “correct” way to do this would be to create a large transparent window covering the whole screen, use that to show the cursor and collect the click, then get rid of the window and use whatever dodgy hack is needed to find the colour at that point.


#5

Hi,
But once i start dragging from the current component(i.e,Color Picker Dialog)
(and this colour picker window is a modal window)
the cross hair cursor is showing proper in whole screen. It means the mouseDrag function working proper. But it won’t happen in simple moving the mouse (mouseMove).


#6

No, of course not. There is no way to do this, because other windows will set their own cursors when you move over them.

That’s why I suggested the large overlay window, so that it’s your own window that you’re moving over, even though you can see the others underneath it. That’s also the only sensible way to capture a mouse-click that’s (seemingly) somewhere else on the screen.


#7