• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use the Hand cursor on an Image !!!!

 
sam patel
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a main Jframe which contains a Jpanel which contains a jscrollpane. THe image is in scrollpane and i would like to use the Hand cursor to move the image up and down the jscrollpane.
Can someone tell me or show me how can i use a hand cursor on an image
I would appreciate if someone can show me a simple example.
THanks in advance.
 
Hetal Seth
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
try the following in the dragGestureRecognised() method of ur DRAGGABLE:
Cursor cursor = new Cursor(Cursor.HANDCUR....);
event.startDrag(cursor, transferable(path), this);
good luck,
hetal seth
 
sam patel
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hetal Seth:
hey,
try the following in the dragGestureRecognised() method of ur DRAGGABLE:
Cursor cursor = new Cursor(Cursor.HANDCUR....);
event.startDrag(cursor, transferable(path), this);
good luck,
hetal seth

Hi Hetal,
Thank you for your reply.
I am kind of new to this.
What is the dragGestureRecognised() method.

I created the Cursor cursor = new Cursor(Hand_Cursor).
I also created mouseDragged(MouseEvent e).
But there is no e.startDrag() method.
Can you please tell me where did you get the event.startDrag() method.
Again thanks.
 
Hetal Seth
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am under the impression that ur tryin to use DragnDrop functionality for ur application. if it is true, then u might have to refer the java.awt.dnd package.
-hetal-
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!