• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to change cusor and calling..........

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to ask, that,
1) when a cursor moves on a Button component it should change into a hand cursor, how can I do that. Please give me code as an example.
2) and I have put a button which is a special one i.e "is not equal to" now I want that when on pressing that button a sign like " is equal to
with a slash on it" appears in the text field how can I do this.
 
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for eg:
first create a cursor like this
java.awt.Cursor c=new java.awt.Cursor(java.awt.Curser.HAND_CURSOR);
(u can find lot of cursers in Cursor class)
then use Component class's method.like this
urComponent.setCursor(c);
now u have a hand cursor
if u need some custom cursors,try this
java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
Image img=tk.getImage("path");
java.awt.Point hotPoint = new java.awt.Point( 0, 0 );
java.awt.Cursor c=tk.createCustomCursor( img, hotPoint, "astring" );
urComponent.setCursor(c);
create an image which'll become as a cursor.then create a Cursor with that image.then use setCursor method from appropriate mouseevent method.OK?
basha
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic