| Site Map | WizTools.org | jCraze Blog |
![]() |
Java CursorChanging mouse cursor is like eating apple-pie!
import java.awt.*;
====================
Cursor cur_wait = new Cursor(Cursor.WAIT_CURSOR);
Cursor cur_default = new Cursor(Cursor.DEFAULT_CURSOR);
Cursor cur_crosshair = new Cursor(Cursor.CROSSHAIR_CURSOR);
Cursor cur_text = new Cursor(Cursor.TEXT_CURSOR);
Cursor cur_hand = new Cursor(Cursor.HAND_CURSOR);
Cursor cur_move = new Cursor(Cursor.MOVE_CURSOR);
Cursor cur_rs_sw = new Cursor(Cursor.SW_RESIZE_CURSOR);
Cursor cur_rs_se = new Cursor(Cursor.SE_RESIZE_CURSOR);
Cursor cur_rs_nw = new Cursor(Cursor.NW_RESIZE_CURSOR);
Cursor cur_rs_ne = new Cursor(Cursor.NE_RESIZE_CURSOR);
Cursor cur_rs_n = new Cursor(Cursor.N_RESIZE_CURSOR);
Cursor cur_rs_s = new Cursor(Cursor.S_RESIZE_CURSOR);
Cursor cur_rs_w = new Cursor(Cursor.W_RESIZE_CURSOR);
Cursor cur_rs_e = new Cursor(Cursor.E_RESIZE_CURSOR);
// Creating custom cursor
Cursor cur_cust = null;
Toolkit tk = Toolkit.getDefaultToolkit();
Image img = new ImageIcon("path/to/img.ext").getImage();
Point p = new Point(0,0); // This is the hot-spot in the cursor
try{
cur_cust = tk.createCustomCursor(img, p, "Cursor ID");
}
catch(IndexOutOfBoundsException ioobe){
System.out.println(ioobe);
}
// Setting cursor for any Component ``c'':
c.setCursor(cur_wait);
|
[Quick Stats: Number of main threads: 2, Number of sub-threads: 0]
Sign Guestbook
|
Who is Subhash?
The contents of this site are copyright© 2000-2008, indiWiz.com. All Rights Reserved.