The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by hly]

Hi,Sir:

I can set my cursor to a image in a text pane. But the image(cursor) only
shows black color. Can you tell me how to make the image colorful in text
pane. I will appereciate your help.

liying
import-bot (20211) [Avatar] Offline
#2
Re: How to make a colorful cursor?
[Originally posted by matt]

If you happen to have David Geary's AWT book, take a look at the custom
cursors section (if you don't have this book I highly recommend it... it
covers tons of useful stuff beyond just AWT components.. stuff that is used
trhoughout Swing and the construction of Swing apps).

Anyway, most Java platforms only support two-color cursors. This is most
likely the problem you are facing. Create a gif file using two of your
favorite colors and make sure it has a transparent background. This is as
fancy as you can get (and there is nothing you can do about without using
native code).

Take a look at the Cursor-related methods in the java.awt.Toolkit class.
Windows machines expect a two-color image that is exactly 32x32. If it is
any bigger or smaller it will be distored to fit a 32x32 area..