Hi Andrew, The size of the custom cursor is native dependent. You can use the getBestCursorSize() to know the size of the cursor supported by the native system which can match your image size. Call getBestCursorSize() and pass your preferred size, typically the size of your image. This method returns the best cursor size that is allowed by the native system. Actually this queries the underlying native system to get this dimension. If you are using the default toolkit, then this will be done by the WToolkit class if you are running on Windows and by MToolkit class, if it is solaris.
These toolkit classes call the respective native methods, queryBestCursor(dimension) in Solaris, and getCursorWidth() , getCursorHeight() in Windows for getting this value. So when you pass an image which is bigger than this, the image will automatically get resized to the best cursor size which is a documented feature. Here it is : (Copied from JDK1.4 docs - getBestCursorSize()) --------------------------------------------------------------- Note: if an image is used whose dimensions don't match a supported size (as returned by this method), the Toolkit implementation will attempt to resize the image to a supported size. Since converting low-resolution images is difficult, no guarantees are made as to the quality of a cursor image which isn't a supported size. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made. HotSpot is an active point within the cursor which is considered as the current mouse location. In a default cursor, it is the tip of the pointer which is taken as the hotsopt. hence for an image, you may choose to have any point within the image as your hotsopt as per your wish, which could be any of the four corners of the image or the center of the image. Hope this helps. Regards, Praveen Andrew Mercer wrote: > Thanks for the responses to my previous email, I can now create a custom cursor from >an image. I have another question though. > > It appears that the cursor that I see is scaled to a set size (width and height) >irrespective of the original size of the image. > > I need to have a cursor with the following dimensions: > > width 300 pixels, height 50 pixels > > Currently the cursor is a square of approximatley 95 x 95 pixels. > > I have tried Image.getScaledInstance(width, height, hints) but this makes no >difference. What I am trying to do cannot be achieved if the cursor cannot be resized. > > Also what does the hotSpot achieve in the following method createCustomCursor(Image >cursor, Point hotSpot, String name). The documentation seems very unclear? > > Thanks Andrew Mercer > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff JAVA2D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help".
begin:vcard n:Mohan;Praveen tel;cell:98401 49793 tel;home:91-44-491 0657 tel;work:91-44-254 1473 / 74 Extn: 314 x-mozilla-html:TRUE org:SIP Technologies & Exports Ltd;OWL-HIP version:2.1 email;internet:[EMAIL PROTECTED] title:Developer note:We don't use JAVA, We make JAVA usable. adr;quoted-printable:;;D-3, Ground Floor=0D=0APrimrose Apartments,=0D=0A15, Ellaiyamman Koil Street,=0D=0AVannanthurai, Adyar;Chennai;Tamil Nadu;600 020;India fn:Praveen Mohan end:vcard
