tags:

views:

1065

answers:

2

I was wondering if there is a way to extract an Image object from a Cursor object in Java.

A use for this would be for instance :

Image img = extractCursorImage(Cursor.getDefaultCursor());

Which you then can draw on a toolbar button (that's the purpose I want it for).

+4  A: 
McDowell
So maybe there is a wau using JNI to find the windows resource containing the graphic and extract that (again using JNI)?I am not familiar with using JNI so if someone knows a way I would be grateful it he/she shared it with us.
Savvas Dalkitsis
Probably - what operating system?
McDowell
Windows. i am guessing version will not matter since probably the Win32 api will be used. I am using vista btw.
Savvas Dalkitsis
You can do this by using LoadCursor and treating the return value as a HICON, I think. http://msdn.microsoft.com/en-us/library/ms648391(VS.85).aspx
McDowell
thanks for the comments... the last comment looks to me as it could be right. as i said i have no clue about JNI. :D are you familiar with it? if so could you help me use that function you mentioned?
Savvas Dalkitsis
A: 

It might be possible to find the system cursor images from JRE. Looking at the source code might be interesting too.

iny
hm i was actually thinking of something more general not restricted on systme cursors but that sounds like a good alternative..
Savvas Dalkitsis