• 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 use the Hand cursor on an Image !!!!

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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-
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic