Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can v use the cursors that are present in the winnt directory?  RSS feed

 
Srinath R
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think v can set the cursor of our own choice but the choice is very limited v have a few methods
getSystemCustomCursor(); is one of them
which suggests that v can get the cursor from the system, can any body suggest how can i use the cursor which is present in the directory "c:\wintnt\cursors" the name of the file is Inodrop.
i have used
Cursor unavail = Cursor.getSystemCustomCursor("Inodrop");
between try catch block which is catching the AWTException
although i dont get any errors during compailation in runtime i get an exception which says
Cursor.getSystemCustomCursor(null);
can any body suggest me the remedy for this.
tnx
srinath
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinath,
I don't really know whatCursor.getSystemCustomCursor() does... the API docs are spotty, and every time I try it it returns null... even if I have created a cursor that has a name... so what I would do is this... I would capture the Inodrop cursor and create a custom cursor that uses it... I tested this out and it works!

  1. Go to Start > Settings > Control Panel.

  2. Click on the Mouse icon.

  3. Click on the Pointers tab.

  4. Scroll down to Unavailable and select it, so the Inodrop cursor appears in the upper right panel... this is where we will capture the cursor from.

  5. Press Cntrl-Alt-PrintScreen. This does a screen capture of the currently selected window.

  6. Close all the Control Panel windows and open up MS Paint. (Start > Programs > Accessories > Paint)

  7. Make sure the screen is large enough and press Cntrl-V. This will paste the screen capture into MS Paint.

  8. Use the magnifying glass to zoom in on the Inodrop cursor in the upper right panel until it is enlarged enough to comfortably cut out.

  9. Use the square selection tool to make a box around the Inodrop cursor. It doesn't have to be perfect, just make sure all of the cursor (including the white edging) is surrounded by the box.

  10. Now, press Cntrl-C. This will copy the selected area to the clipboard.

  11. Go to File > New and create a new file. You don't have to save 'untitled'... unless you really want to save a cool picture of the mouse pointer selection screen (and who wouldn't!).

  12. Now, go to the Image > Attributes menu. Choose pels as the units and put 32 in both the Width and Height textfields. Press OK.

  13. Now you have a little bitmap. Go to Edit > Paste. Ignore the message that asks if you want to enlarge the bitmap if it appears... you do not, you want a 32x32 bitmap. Move the pasted image of the Inodrop cursor around until it all fits (including the white edging) into the little 32x32 bitmap.

  14. Now choose some color that isn't used in the image (like that wonderful shade of electric purple!) and use the Paint Bucket tool to fill in all the light gray area around the cursor (and all the nooks inside it too... anywhere that light gray appears.) When done, go to File > Save As and save the image as "Inodrop.bmp". Exit MS Paint.

  15. You now have a bitmap image of the cursor you want! Unfortunately, Java does not read bitmaps... you need a GIF or JPG for that... You should use a GIF image because it supports transparency (so you can get rid of the colors around the edges of your cursor.) If you have a BMP-GIF converter already(like MS Photo Editor, or PhotoShop), ignore the following instructions... if you don't have a BMP-GIF converter there is a free one called GiFFY that can be found at ( http://flybum.hypermart.net under the Downloads menu. Download and install GiFFY, then run it (or do all this in your own BMP-GIF image program... whatever...).

  16. Press the Load BMP button and load your "Inodrop.bmp" from wherever you saved it.

  17. Click the little Transparent checkbox near the bottom of the screen... it should select your 'new' color as the transparent color. If not you can move your mouse over the image until the color you want to be transparent shows up... then click and it will change. You can choose Interlaced or not... it doesn't really matter on an image this small.

  18. Now click on Save GIF and save your brand new GIF image as "Inodrop.gif" in the same directory of the Java program that will use it (or in a directory off it like "cursors" or something... somewhere you can get to it easily from your program.)

  19. [list]Now exit GiFFY and write some Java code like the following:

    [/list]
  20. Now you're done! (Whew... that was alot of work... )


  21. HTH,
    -Nate
    [This message has been edited by Nathan Pruett (edited February 21, 2001).]
 
Srinath R
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot Nathan that was very informative i will implement it and get back to u if i find any problem.
srinath
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!