How to identify mouse cursor image?

I am doing some testing in java- everything else so far is working, but I can't find out how to.. find which image the mouse pointer is. I need to be able to tell when a mouse cursor goes over a link and displays the right cursor. It switches between the default arrow, the little hand for links, and a custom cursor, but I don't know how to retrieve that information.
Any ideas?
At first I was going to just use screenshots- but cannot capture mouse cursor/icon that way, and this way would work better.
Thanks!

That would make sense, but I haven't found any functions on "get the cursor for the component", or of anything related to getting the cursor.
I was going to use the robot to move to two specified points on the screen, but then I still have the issue of somehow retrieving any information about the cursor(aside from position/clicks). Would you know offhand which package/function(method) would have it? That one only showed stuff related to movement/events, no cursor information besides position/clicks.
Thanks!
Edited by: doomtoo on Sep 3, 2008 11:59 PM

Similar Messages

  • Mouse Cursor Image

    Hello All,
    I have read that java.awt.Robot class does not capture the mouse cursor image when the desktop snapshot is taken, and I wanted to see how developers are getting around with this. Is a pure Java solution possible or they use JNI?.I have read that developers try to draw image of mouse cursor image at given x,y on the desktop image. What's the final possible solution?
    Thanks
    Nitin

    nitin-36 wrote:
    Hello All,
    I have read that java.awt.Robot class does not capture the mouse cursor image when the desktop snapshot is taken, and I wanted to see how developers are getting around with this. Is a pure Java solution possible or they use JNI?.I have read that developers try to draw image of mouse cursor image at given x,y on the desktop image. What's the final possible solution?
    Thanks
    NitinThis has absolutely nothing to do with JMF, and you answered your own question. Take the screenshot and draw a cursor where the cursor should be. BufferedImages are easy to draw on.

  • How to identify mouse status

    Hello friends,
    Is it possible to identify the mouse status , I stress mouse status not mouse event i would like to identify mouse cursor type at any instant of time is it possible.
    One more thing is it posible to get the mouse cursor type outside a awt component
    Regards
    hari

    You would have to use the public Cursor getCursor() method of java.awt.Component to do what you're talking about. Additionally, without looking into native code, I don't think it would be possible to get the mouse status outside of your application (like if you had your mouse on a system-depent xterm window or visual basic application).
    -bx

  • How to extract the mouse cursor image without using JNI

    I want to get the image of the mouse cursor of the system using java. The Robot class captures the screen only, but the mouse icon image is not the part of the screen, so it is not easily detected. But we can get the mouse cursor position using API, but how to get the exact image icon, without using JNI. I don't want to generate my own cursor at that position.

    I am building a Remote Desktop kinda app using java..... I want the screen of the remote comp to be viewed on my screen and generate events from my machine to the remote machine. So, I am capturing the screen images of the remote machine. But the cursor is not part of the screen object. i want to extract the cursor image icon from the remote machine to my machine and render the image.

  • How to hide mouse cursor ?

    How can I hide the mouse cursor, when I am over a component ?

    I don't know if there is a better way but ...
    create a gif (using PaintShop Pro or something) which has nothing in it or if that can't be done as few pixels as possible. I created mine in c:\tmp\blank.gif for the program below
    import java.awt.*;
    import javax.swing.*;
    import java.net.*;
    public class ViewCursor
    extends JFrame
    public ViewCursor()
    throws Exception
    Cursor myCursor = null;
    try
    ImageIcon ii = new ImageIcon(new URL("file:C:/tmp/blank.gif"));
    Image im = ii.getImage();
    Toolkit tk = getToolkit();
    myCursor = tk.createCustomCursor(im, new Point(0,0), "MyCursor");
    catch (Exception e)
    System.out.println("myCursor creation failed " + e);
    getContentPane().setLayout(new FlowLayout());
    JPanel p1 = new JPanel();
    JPanel p2 = new JPanel();
    JButton b1 = new JButton("one");
    JButton b2 = new JButton("two");
    p1.add(b1);
    p2.add(b2);
    p1.setCursor(myCursor); // set panel 1 to have the customised cursor
    getContentPane().add(p1);
    getContentPane().add(p2);
    public static void main(String[] args)
    throws Exception
    ViewCursor v = new ViewCursor();
    v.setSize(200, 200);
    v.setVisible(true);
    when you run this, the cursor disappears when its over p1 / b1

  • How to move mouse cursor

    Hello
    does anybody know how to move the mosecursor with lab view code. If anybody
    have some vi's that take care of this I would be most grateful
    Regards
    Stian Langeland

    For the Win32 case, there's an example available that does this very thing:
    http://digital.ni.com/explprog.nsf/websearch/c33e65e20b23f3e4862565ec004d67ec
    I searched the National Instruments Example Programs Database
    (http://www.ni.com/support/epd/) for "mouse" in order to turn this up.
    Regards,
    John Lum
    National Instruments
    > > Hello
    > > does anybody know how to move the mosecursor with lab view code. If anybody
    > > have some vi's that take care of this I would be most grateful
    > >
    > > Regards
    > > Stian Langeland
    >
    > I think there is no "native" labview solution to your problem.
    > It depends on the platform you are working on. If you use Win32 i'd suggest (if
    > you really need to move the mouse cursor programmatically... do you?) to call
    > some Win32 api func
    tion like MOUSE_EVENT or SEND_INPUT on WinNT. Look them up
    > in M$ documentation. To call them use from the Functions Palette -> Advanced
    > -> Call Library Function.
    > Hope this helps.
    > --
    > Wolf-Dieter Wall

  • How should a custom cursor image be constructed?

    This relates to Java 1.7_u11 and JFX 2.2.4 on Windows 7 64 bit.
    When I set a Node's cursor to Cursor.CROSSHAIR, the crosshair is displayed with complementary colour to its screen background (e.g. black on white, blue on yellow, etc.) However when I construct my own custom crosshair image, 32 pixels square, with transparent-white background pixels and opaque-black crosshair pixels, and create an ImageCursor from it to use as the cursor, it works fine, but always displays as black, irrespective of the background that it's being displayed over. I've tried various ways of creating the image.
    So my question is, is there something special about the built-in Cursor images, and how should we emulate it for an ImageCursor? More generally, how does the 'blend mode' for cursor images work?
    (Apologies if I'm displaying dismaying ignorance here.)

    Hrm, I tried Crosshair on my Linux computer with different background fills in Scene and didn't notice any change in color. It was always a cross with white fill and black outline. I wonder if the appearance of certain cursors are OS specific.
    Anyways, I don't see anything in the documentation to set that. If you want a more customizable cursor, submit an RFE to http://javafx-jira.kenai.com/

  • How to replace mouse cursor.

    How would you replace the mouse cursor in ActionScript 3?  I mean with like a movie clip or a graphic within Flash.  Thanks.  Code prefered.

    You would need to use a movieclip so that you can assign an instance name to it... here I use cursorMC as the instance name:
    Mouse.hide();
    function followMouse(evt:MouseEvent): void{
         cursorMC.x = mouseX;
         cursorMC.y = mouseY;
    stage.addEventListener(MouseEvent.MOUSE_MOVE, followMouse);

  • How To Change Mouse Cursor Icon To Hand And Click Middle Of Player To Pause In Strobe Media Playback

    Hello,
    Thank you for providing a platform where uses can pose questions to Adobe employees. This certainly helps us all cut right through it.
    Similar to YouTube's player (as well as many others), I was wondering if it is currently possible for users to enable functionality on Strobe Media Playback to change the mouse cursor to a hand/point cursor upon hovering over Strobe Media Playback's buttons (such as pause, the volume controls and that initial large centered middle play button),
    And, whether or not it is currently possible to enable functionality to pause/play videos merely by clicking the middle of the video screen (within the normal view mode as well as the full screen mode). Again, with YouTube, Vimeo, JW Player, and many others, such functionality is currently built-in by default.
    I look forward to any advice you are able to provide. Thanks again for providing this discussion platform for users.
    - C.R.

    Hi, thank you for your suggestions and for the interest in our player.
    The full area click issue is an older one, tracked at http://bugs.adobe.com/jira/browse/ST-156 . Unfortunately, it will not be fixed in this release.
    The hand cursor issue is now tracked at http://bugs.adobe.com/jira/browse/ST-331 - thanks for suggesting it!

  • How to change mouse cursor during drag and drop

    Hi Guys,
    Iam performing a Drag and drop from Table1(on top of the figure) to Table2(down in the figure).
    see attached figure
    http://www.upload-images.net/imagen/e80060d9d3.jpg
    Have implemented the Drag and drop functionality using "Transferable" and "TransferHandler"using the java tutorial
    http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo
    Now My problem is that ,I want to make the 1st column in Table2(ie: Column2-0) not to accept any drops so that the cursor appears like a "No-Drop" cursor but with selection on the column cell during a drop action.
    Also when I move my cursor between "column2-0" and "column2-1",want to to have the "No-Drop" and "Drop" cursor to appear depending on the column.
    How can I achieve it using the TransferHandle class.Dont want to go the AWT way of implementing all the source and target listeners on my own.
    Have overridded the "CanImort" as follows:
    public boolean canImport(JComponent c, DataFlavor[] flavors) {
         JTable table = (JTable)c;      
    Point p = table.getMousePosition();
    /* if(p==null)
         return false;
    int selColIndex = table.columnAtPoint(p);
    if(selColIndex==0)
         return false;*/
    If I execute the above commented code,The "No-Drop" Icon appears in "column2-0",but no cell selection.Also If I move to "column2-1",which is the 1st column,Still get the "No-Drop" Icon there,also with no cell selection.
    for (int i = 0; i < flavors.length; i++) {
    if ((DataFlavor.stringFlavor.equals(flavors))) {
    return true;
    return false;
    Thanks in advance.....
    Edited by: Kohinoor on Jan 18, 2008 3:47 PM

    If you found the selection column based on the mouse pointer, then based on the column, you can set the cursor pointer as any one as below :
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    setCursor(new Cursor(Cursor.HAND_CURSOR));

  • How to bring mouse cursor to the default button of a dialog, like in windows

    Anybody know how to achieve this in LV?
    Please see the attached screenshot.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    Automatically move mouse pointer to the default button.PNG ‏34 KB

    Dear partha,
    1) You can be able to trace out the location of the button
    2) You can be able to move the cursor to that location
    3) You can be able to automatically generate a click on that button
    Use user32.dll to achieve all this. when u use it in CLN(Call Library Node), u can c functions 4 that.
    Try and ask if further help needed!!!!!
    Thanks,
    Mathan

  • I want change the mouse cursor image when cursor come on the label

    how can i make this??

    Hi,
    Write a mouse listener to ur label like this. When mouse enter the lable region what ever the cursor u wish to give in the mouseentered region that will appear.
    Use the follwing code:
    jlabel.addMouseListener(this);
         public void mouseClicked(MouseEvent arg0) {
         public void mouseEntered(MouseEvent arg0) {
              setCursor(Cursor.getPredefinedCursor (Cursor.HAND_CURSOR));
         public void mouseExited(MouseEvent arg0) {
              setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
         public void mousePressed(MouseEvent arg0) {
    Rgds,
    Kumar.
         public void mouseReleased(MouseEvent arg0) {
         }

  • Mouse cursor effects

    Hi, how would I go about changing the mouse cursor image? I have a jLabel with an image of graph on it and I would likt the mouse cursor to change to a cross-hair when the mouse i moved onto the jLabel. Does anyone have an idea as to how to achieve this?
    Thanks!!

    call setCursor() on the component you want the cursor to be different for with whateve Cursor object you want to use.

  • Drawing current  Cursor Image.

    I want to draw the current cursor image on the BufferedImage. Basically I am taking snapshot of desktop using java.awt.Robot. But the image of desktop does not contain mouse cursor image . How can I know which type of cursor image I should draw(Hand cursor, Move Cursor for example ...). Is there api which will allow me to create mouse cursor image based on current cursor style, when snapshot of desktop image was taken?.

    Hi,
    I'm afraid there is no API for that. I've been looking for it as well. The issue has been discussed on the java dot net forums also.
    [http://forums.java.net/jive/message.jspa?messageID=293665#293665]
    Piet

  • Zoom an Image whereever the mouse cursor is placed

    Hi,
    I have to zoom the image where ever the mouse cursor moves.
    If i am moving the mouse at the position (x,y) then that part of the image has to be zoomed,
    so that the image pixels will be visible properly to the user.
    The image is set to label.
    I know that the code has to be written in MouseMotionListener.
    I will get the position of (x,y) when the mouse is moved on the image.
    But how to ZoomIn the image where ever the mouse cursor is?
    Can any one suggest me what i have to do exactly.
    Thanks & Regards

    Hi,
    I saw that code some time before.
    The code is using java5, but i am using java 1.4

Maybe you are looking for