Cursor does not line up

hi
when i add a cursor to my panel inside a frame
the cursor never lines up with the x and y varibles it is always
a cm away from where i clicked?
do i have to resize the cursor some how?

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class CursorCheck extends JPanel {
    Point loc = new Point();
    public CursorCheck() {
        BufferedImage image = getImage();
        Point hotspot = new Point(16,16);
        setCursor(Toolkit.getDefaultToolkit()
                         .createCustomCursor(image, hotspot, null));
        addMouseListener(ml);
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setPaint(Color.blue);
        g2.drawLine(0, loc.y, getWidth()-1, loc.y);
        g2.drawLine(loc.x, 0, loc.x, getHeight()-1);
    private BufferedImage getImage() {
        int w = 27, h = 27,
            type = BufferedImage.TYPE_INT_ARGB_PRE;
        BufferedImage image = new BufferedImage(w, h, type);
        Graphics2D g2 = image.createGraphics();
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setPaint(new Color(0x333333));
        g2.draw(new Line2D.Double(w/2, 0, w/2, 8));    // n
        g2.draw(new Line2D.Double(0, h/2, 8, h/2));    // w
        g2.draw(new Line2D.Double(w/2, h-8, w/2, h));  // s
        g2.draw(new Line2D.Double(w-8, h/2, w, h/2));  // e
        g2.dispose();
        return image;
    public static void main(String[] args) {
        JFrame f = new JFrame("click me");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add(new CursorCheck());
        f.setSize(400,400);
        f.setLocation(200,200);
        f.setVisible(true);
    private MouseListener ml = new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            loc = e.getPoint();
            repaint();
}

Similar Messages

  • Cursor does not change during the editing of clips

    Hi. I am new to iMovie and am looking for some help. I have imported my clips, put them in my timeline and I want to shorten the clips. According to the movie that is on the Apple web site, when moving my cursor over the line separating my clips, my cursor is to 'change' allowing me to shorten the clip. Well, my cursor does not change. Is there a setting that needs to be corrected. Thanks for any help that can be offered.

    Hi konrad - the View Menu DOES have a 'Show Clip Volume Levels" IF you are using iMovie HD!
    But according to your Profile you have iMovie 4. Volume control in that version is at the bottom beneath the Timeline Audio tracks.
    Hope this helps clear up your confusion.
    Better to use the iMovie 4 forum in your case!:-)

  • Entering values in TableMaintenance,cursor does not stop at error record ?

    Hello,
    Very Good Morning!
    When creating new entries in Table Maintenance, Cursor does not stop at the error record. It display's an error where the error is. But, cursor will skip to the first field of the record.
    Ex : Sales Org, Mater, Sales Obj %, Frist arr date.
    Suppose these are the fields available and I want to create a new entry.
    When i enter incorrect value in Sales Obj %, it is displaying error message saying that i need to enter correct value. But the Cursor is skipping away to the first field Sales Org.
    PLease help what to do...I tried using set cursor. But, I am not sure how to excatly use it and it was not working. 
    Any help will be appreciated.....
    Thanks & Regards,
    Krishna Chaitanya

    Hello,
    This question is not answered.
    I want to close this question.

  • Word label template does not line up with avery 5160 8160 paper, Mac Maverick

    Word label template does not line up using avery 5150 or 8160 paper

    These forums are for Apple products and the best place to ask about problems with MS stuff is in there newsgroups:
    http://www.microsoft.com/mac/community/community.aspx?pid=newsgroups
    When you don't see Post New Topic, it means you are not in a Forum but a Category page listing one or more Forums. You need then to enter a Forum by clicking on one. Then you will see the Post New Topic item at the top left.

  • Cursor does not change when hovering over pop-up window link

    I created a text link for a pop-up window. The link does work, but the cursor does not change to a pointy finger, the standard link icon.
    I don't know a lot of javascript, but can figure it out if it's just adding some code.This was done in CS3. Any help would be appreciated! Here's the code:
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    Thanks in advance.
    Todd

    A link would be nice but I suspect that you are not gettign the finger (you knwo what I mean) when you roll over the link because your href is  not set to anything.
    <a href="" onclick=MM_openBrWindow('images/image.jpg','largeDisplay','scrollbars=yes,resizable=yes,width=100,height=120')
    Set your href to "#" or "javascript:;" - the latter is preferred.

  • HT4113 My daughters iPod touch asks for her pass code but when she types it in the cursor does not move or input any characters so,she cannot get into the iPod. This has suddenly happened for no apparent reason

    My daughters iPod touch asks for her pass code but when she types it in the cursor does not move or input any characters so,she cannot get into the iPod. This has suddenly happened for no apparent reason, what can we do? Can anyone help please?

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Cursor does not click the sign-out button in yahoo, rediff etc pages ?

    cursor does not click the sign-out button in yahoo, rediff etc pages. E.G once I open my yahoo page, the cursor pointer will not change it's appearance to the finger type when I try to click the sign-out or inbox button. This does not happen with chrome or explorer.

    That problem can be caused by the Yahoo! Toolbar or the Babylon extension that extents too much downwards and covers the top part of the browser window and thus makes links and buttons in that part of the screen not clickable.
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • Cursor does not move, Cursor does not move

    Cursor does not move, can not be controlled by wireless mouse and normal mouse, Are there any solution for this problem? Thank!

    in selecting the word, it is very difficult to just place a cursor in the word to make any correction, because it wants to highlight it and it is near impossible to deselect
    The standard mouse/text selection action should only select a word when you double-click it. Therefore you should be able to position the cursor within a word by just single-clicking it.
    when I do finally get a cursor to appear instead of a highlighted word, the arrow keys don't move the cursor to where I need it
    That certainly sounds amiss. I don't think I've ever seen a case where the cursor keys don't move.
    So I'm thinking Leopard must have some preference / key preference thing going on?
    There is a Keyboard & Mouse preference pane in System Preferences which is clearly the place to start, but off-hand I can't think which options there would cause this kind of setup.

  • Tool cursor does not change or does not show up

    If you change tools in Photoshop but the cursor does not change (or disappears entirely), this indicates a bug in your video card driver. To fix it, you need to update your video card driver.
    Sometimes you can fix it temporarily by turning down the hardware or driver acceleration in the properties panel for the video card.

    Chris Cox 11/23/02 4:59pm

  • Cursor does not change for pop-up window

    I created a link for a pop-up window. The link does work, but the cursor does not change to a pointy finger, the standard link icon.
    I don't know a lot of javascript, but can figure it out if it's just adding some code. Any help would be appreciated! Here's the code:
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    Thanks in advance.
    Todd

    Hi Todd,
    i got the same problem.(cursor not change for pop-up windows) and because i m not an expert in internal html code i did try several solutions to fix it.
    The easiest (but also even longer if u need to do severals) is to create a button (withs 2 overflight changing pics) with "inserer", "image survolée"
    the "image survolée" can be linked to a pop-up window with the correct effect.  To do so highlight the "expected new link to" and on right side task bar ad a "comportement" named "ouvrir la fenetre du navigateur" and optionally choose the size and windows available function of the pop-up. It works even if u need to proceed first with an overflight changing button.
    The result is longer to obtain and not absolutely perfect. So I guess it s only an help solution for a single mateer. i would be glad to get another solution with a text link rather than using the overflight button system. Technically it should be better, more efficient and faster to proceed with applying an html code that really makes the text appearing as a classic link to a new windows whatever pop up or full size window. Please let me know if u get further answer to fix this problem.
    Many thx and excuse my technical english translation about DreamCs4

  • Cursor does not follow in garage band

    I click on record and the cursor does not move so I can not follow in what part of the timeline I'm, how can I solve this?

    Well, I closed Garage Band and reopen it and it solved the issue, go figure!!

  • Cursor does not move.

    On my IMAC the cursor does not move, but show connected and the click works. just will not move cursor on the screen. I doen the following.
    - replaced batteries
    - restarted computer
    - unplugged computer and restart
    - restart while hold command+options+P+R
    oh ya, I did notice my picture for my log on changed.
    Please help.
    thanks

    Bootup holding CMD+r, or the Option/alt key to boot from the Restore partition & use Disk Utility from there to Repair the Disk, then Repair Permissions.
    Does the mouse move booted from that partition?
    Do you have a USB Mouse to try?

  • Cursor does not change to a circle when using eraser

    Cursor does not change to a circle when using the eraser.
    I'm sure it must be a tick box somewhere.
    Its always been ok previously.

    I had this same problem and was searching for answers. I also prefer using a circle instead of crosshairs. I hope you've figured it out by now, but, if you haven't, here is the answer (I am using Elements 9, but, it should work for other versions I think):
    1. Open up Elements Editor, Click on Edit, Click on Preferences, Click on Display & Cursors.
    2. Under Painting Cursors, select Full Size Brush Tip
    3. (optional) - if you want crosshairs within your circle, then also select Show Crosshair in Brush Tip.
    4. Click ok.
    Now use the brush, and it should have a circle to use.
    P.S. Sometimes if you have your Caps Lock key on, that removes the circle as well.

  • Cursor does not appear on Facebook page load. Spacebar shifts page down.

    Cursor does not appear anywhere on Facebook page load. It used to land in the first text box, and as I was used to this I would open an FB page and start typing. Nothing was entered into the text box, and when I hit Spacebar it shifts the page down.
    Couple of things:
    It acts this way both in normal and in "safe mode".
    It acts correctly on Google - it is my home page and when I open it the cursor is always in the search box. It also acts correctly on YouTube.
    The cursor DOES NOT appear in the URL bar (thankfully)
    The cursor DOES NOT appear in any text boxes on any other pages I open >> The Weather Channel, TED.com, Amazon.com
    The Spacebar scrolls the screen down one frame at a time.
    It has the same behavior with the "Always use the cursor keys to navigate within pages
    I am using FF 18.0.1 on Windows XP
    I have tried a lot of the weird tips and tricks suggested on this support forum, but none of them address specifically this issue.
    Thanks in advance.

    If I'm not logged on then the cursor is in the login form at the top.<br />
    Once logged in the main body has focus and not a specific element, so you have to click in an input filed to set focus to it.
    If it worked before then they have changed the code of that page recently and it is just a coincidence that it happened around the time that Firefox updated.

  • HP wireless mouse H1D34AA cursor does not move

    My wireless mouse sometimes does not work - ie the cursor does not move although I can click and the light comes on. Batteries have been changed. This seems to happen intermittently. Any ideas? I have looked at devices and properties etc and removed the dongle and replaced it, nothing seems to work. This mouse is about 6 months old! Thanks

    My wireless mouse sometimes does not work - ie the cursor does not move although I can click and the light comes on. Batteries have been changed. This seems to happen intermittently. Any ideas? I have looked at devices and properties etc and removed the dongle and replaced it, nothing seems to work. This mouse is about 6 months old! Thanks

Maybe you are looking for

  • How can I use a new computer without deleting everything on iPod?

    Hey Guys I need a bit of help. My old computer died, it was running Windows XP. I've got myself a new computer running Windows 7. I have a copy of my iTunes folders from my old computer (taken 2 days before it died) How can I use a new computer witho

  • How to create a "Custom Color" for highlighting? (Acrobat XI)

    March 10, 2014 How to create a "Custom Color" for highlighting? (Acrobat XI) The numbers in the RGB and other fields change as various numbers are changed. I wanted to create a pale orange: Hue               13      Red      255 Saturation   240     

  • Install IDES ECC6- Abap Import phase error

    Hi all, I have seen many post on this error but I have not still understood why it happens. I have tried to install an IDES ECC6 on Windows 2003S 32 bit with 4gb of RAM on a VMWARE virtual machine. I have done all the preparation steps: 1) adjust net

  • No sound on Nano 3G

    I just got a new Nano 3G a few days ago. Today I got no sound when I hooked the nano up to my cassette adapter. Hmmm. So I tried it at work with my headphones. No sound. Well I read a post here that says to press the center and menu buttons together.

  • What is the use Business objects over WAD.

    Hi Folks, what is the use Business objects over WAD. How sap bw is going to use Business Objects. Thanks, Cheta.