// Set up an hour-glass cursor when the cursor is over myComponent. // You could use any of the predefined Cursors such as // WAIT_CURSOR, HAND_CURSOR, DEFAULT_CURSOR, MOVE_CURSOR, CROSSHAIR_CURSOR. // TEXT_CURSOR or the various resize cursors. import java.awt.Cursor; //... myComponent.setCursor( Cursor.getPredefinedCursor ( Cursor.WAIT_CURSOR ) );Every Component/ Container can have a different cursor so that the cursor automatically changes shape when the user waves the mouse over each Component.
Normally you just select from one of the pre-dedefined cursors, but you can create a custom cursor with Toolkit. createCustomCursor().
createCustomCursor wants an Image. You can create it in the usual way from a *.png or *.gif file, by fishing it out of a resource. You can also create it with the low-level line and bit drawing tools. It won’t take a *.ico, *.ani or *.bmp file directly. You will have to convert them with utility like IconXP.
Cursor is used more generally for anything that marks a place, e.g. you could call the current seek position in a file a cursor, though in recent times, the term is used exclusively for the mouse cursor.
You can override the standard cursor in HTML like this:
<!-- Applying a custom windows cursor over the whole body of the document --> <!-- Insert this in the head section --> <style type="text/css"> body{ cursor: url("../cursor/3dorange.cur"),auto; } </style>
This works with most Windows browsers such as Internet Explorer, Avant, Flock, Chrome, FireFox, SeaMonkey or Safari.
To test your browser’s abilty to change the cursor for just a paragraph, wave the cursor over this text, and see if your cursor temporarily changes to an orange cursor.
|
|
You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) |
| http://mindprod.com/jgloss/cursor.html | J:\mindprod\jgloss\cursor.html | |
![]() | Please email your feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording,
broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.179.212] | |
| Feedback | You are visitor number 13,116. | |