Results 1 to 4 of 4
  1. #1
    mistercaste is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default Custom Cursor Mouse

    hi
    I'm working on a canvas and need to transform
    my mouse cursor to a table containing some
    attributes when passing on some elements
    inside the canvas.
    I can catch the "mouse over" and "mouse out"
    events, but I can't transform my mouse Cursor.

    The final effect I need is something like the little
    window that opens when passing the mouse on
    advertising links when browsing the internet..

    Any ideas on how could I do that with Swing?

    thanks

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Have a look at the Toolkit.createCustomCursor( ... ) method.

    kind regards,

    Jos

  3. #3
    mistercaste is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    Thanks for your answer, JosAH.
    The problem with createCustomCursor(..) is that
    it doesn't allow to use a java Component (panels,
    frames..?) as cursor, but only java.awt.Image
    objects.
    Is there a way to "cast" a JTable to an Image so
    that I can print the content of a bean in a box to
    use as a cursor? Or if not a JTable then everything
    else that allows to use it as a cursor?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Any JComponent can be made into an image by creating a BufferedImage the size of the JComponent, extracting the BufferedImage's Graphic object, and drawing the component with this Graphics object (I think these are the steps as it's been a while since I've done this).

Similar Threads

  1. button that runs away from the mouse cursor
    By MartinBenes71 in forum New To Java
    Replies: 1
    Last Post: 01-28-2010, 08:00 AM
  2. Mouse Listener for mouse floating over object?
    By Krooger in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2009, 04:34 AM
  3. change the mouse cursor - crosshair cursor
    By cassysumandak in forum New To Java
    Replies: 1
    Last Post: 09-28-2009, 01:57 AM
  4. Cursor
    By serfster in forum New To Java
    Replies: 2
    Last Post: 06-15-2008, 05:49 AM
  5. Using a cursor
    By notnumber6 in forum New To Java
    Replies: 3
    Last Post: 11-26-2007, 10:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •