Change the mouse pointer to an Hour glass

hello,
Could any one of you let me know how to make mouse pointer to an hour glass in swing application.
Thanking you in advance..
Ram

Check out how I do this in my Draggable classs
you are welcome to use and modify this class, but please don't change the package or take credit for it as your own work
package tjacobs.ui;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
* tjacobs.ui.Draggable<p>
* Makes a component draggable. Does not work if there's a layout manager
* messing with things<p>
* <code>
*  usage:
*                 Component c = ...
*                 new Draggable(c);
*                 parent.add(c);
*  </code>
public class Draggable extends MouseAdapter implements MouseMotionListener {
    Point mLastPoint;
    Component mDraggable;
    public Draggable(Component w) {
        w.addMouseMotionListener(this);
        w.addMouseListener(this);
        mDraggable = w;
     public Draggable(Window w, Component drag) {
          drag.addMouseMotionListener(this);
        drag.addMouseListener(this);
          mDraggable = w;
    public void mousePressed(MouseEvent me) {
          if (mDraggable.getCursor().equals(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))) {
               mLastPoint = me.getPoint();
          else {
               mLastPoint = null;
     private void setCursorType(Point p) {
          Point loc = mDraggable.getLocation();
          Dimension size = mDraggable.getSize();
          if ((p.y + WindowUtilities.RESIZE_MARGIN_SIZE < loc.y + size.height) && (p.x + WindowUtilities.RESIZE_MARGIN_SIZE < p.x + size.width)) {
               mDraggable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    public void mouseReleased(MouseEvent me) {
        mLastPoint = null;
    public void mouseMoved(MouseEvent me) {
          setCursorType(me.getPoint());
    public void mouseDragged(MouseEvent me) {
        int x, y;
        if (mLastPoint != null) {
            x = mDraggable.getX() + (me.getX() - (int)mLastPoint.getX());
            y = mDraggable.getY() + (me.getY() - (int)mLastPoint.getY());
            mDraggable.setLocation(x, y);
}

Similar Messages

  • How can i change the mouse pointer image?

    Hi friends!!
    It's possible to change the mouse pointer image in Swing?
    Thanks a lot.

    There's a setCursor() method on the frame component.

  • I would suggest a new feature:The possibilty to change the mouse pointer icon when you hover on an a

    I would suggest a new feature:The possibilty  to change the mouse pointer icon when you hover on an active link by any other one icon I select.

    Current Firefox versions have a feature called tear-off tabs.<br />
    You can detach a tab from the current window and open it in a new window by dragging a tab in the browser window.<br />
    You can drag that tab back to the tab bar in the original window to undo that detaching.
    bug489729 (Disable detach and tear off tab):
    * https://addons.mozilla.org/firefox/addon/bug489729-disable-detach-and-t

  • Changing the mouse pointer to a cursor?

    Hi,
    I am using a graph or perhaps a polar plot, not sure yet, but I realy wanted to know if there is any way to make the mouse pointer act like a cursor, such that I can click on something on the graph and know where the mouse clicked (the coordinates) and perhaps change the appearance of the hand to something else? So I DO NOT have to use a cursor. I want the user to just click and not have to drag a cursor around.

    Check out the Gtoolbox at gtoolbox.topcool.net. It has the functionality you are looking for.

  • Why the mouse pointer in Logic Pro does not change shape during work in OSX 10.9.1?

    I've a MacBook Pro Retina 15-inch Late 2013 and I'm using two external displays. One connected to to the HDMI port (display 1) the other to thunderbolt (display 2). The MacBook display is closed. I’m working with Logic Pro 9.1.8 (32bit) with OSX 10.9.1
    Why the mouse pointer in Logic Pro does not change shape during work???
    It was already difficult with OSX 10.9 but now after upgrading to 10.9.1 it's game over!
    At least before I could select which display use Logic Pro to have all the shape functions of the pointer. Not in both displays, so to be forced to edit in ONLY ONE of the two displays using this workaround: (right click on Logic icon in Dock: Option --> Desktop on Display 1). Now or I select “Option --> All Desktops” or does not work. However, by selecting all displays you say goodbye to Mission Control. This can’t be a solution!!!
    The amazing thing is that Nuendo has no problem while Logic Pro, Apple's native software, it can't!
    With Nuendo it’s indifferent in which display you are working, the shape of the mouse pointer changes shape depending on the requirement in both displays.
    This thing drives me crazy!
    Solutions?
    Here some ideas in other foums:
    http://www.logicprohelp.com/forum/viewtopic.php?f=1&t=86264
    But this aren't really solutions but workarounds. Use Logic in all desktops makes Mission Control useless!!

    I installed all over again by formatting as suggested by the genes of pro application support. Each plug-in, each virtual instrument, a job that lasted 3 days. And as suggested for each new plug-in I proceeded to check the proper functioning of Logic Pro and did each time a back up with Time Machine.
    The Result:
    Logic works as it should ONLY on the primary monitor and ONLY on the first desktop.
    BUT
    Reason and Nuendo dont' have this issue !!
    I believe that Apple developers are thinking only to mobile phones and things like messages or face time.
    And that's not all!
    After a few weeks, perhaps by installing a version of Adobe Acrobat, I say maybe because I'm not sure, logic has stopped working properly. Again problems with the mouse pointer.
    Luckily I had a back up! But now I'm terrified to install new programs. Thanks Apple!

  • The answer helped me.But still, what are the settings that I have to change for the behavior of the mouse pointer towards finder? Also the mouse pointer sometimes  doesn't accept my command and start clicking itself.what is the problem and how to fix it?

    The answer helped me.But still, what are the settings that I have to change for the behavior of the mouse pointer towards finder? Also the mouse pointer sometimes  doesn't accept my command and start clicking itself.what is the problem and how to fix it?

    If the mouse clicks something on its own then it looks like you have a hardware problem with the trackpad or possibly the battery that is right underneath the trackpad.
    I have read that the battery can swell and that would put pressure on the trackpad.

  • Can I change the look of the mouse pointer?

    I was wondering if it’s possible to change the look/style of the mouse pointer just like you can in Windows?

    Unsanity's Mighty Mouse is the only one I know of that can.
    They also have this page of cursors they've already made you can use with the program.

  • Is there a way to keep the mouse pointer in my window

    I would like to change the cursor so that it can not go outside my application window until they exit the program. Is this possible?

    Just because you disagree with its usage does not make
    it an invalid question. Suppose you had an
    application dedicated to real-time monitoring of a
    high-pressure system. In our hypothetical example,
    accessing other parts of the system without first
    properly "dismissing" the application could be
    potentially hazardous - people could get hurt. In
    this case, would it not make sense to make the
    application "system-modal"? Furthermore, it would be
    a convenience to the operator if the mouse pointer
    were trapped in this critical application.
    How would one go about trapping the mouse cursor
    inside this application?Yes, it would make sense to make this application system-modal. And it would also make sense to not allow any other applications to run on the monitoring system. For such an application, then, it would occupy the entire screen and there would be no way to swap away from it to any other application. Which is what several people suggested for this rather non-critical application, I believe.
    But in the ordinary case, where you are running on a system that does allow multiple applications to run, trapping the mouse cursor in a single application is bad manners and an alternate solution should be sought.

  • Just got a new macbook air and every time I close the cover and then reopen it later the mouse pointer freezes. I've just updated the operating system but no help Seems like it might be a software problem with mousepad. Its only 3 weeks new !

    I purchased a Macbook Air on 01st October and from day 3 every time I close the cover and reopen it later the mouse pointer is frozen
    I updated the operating system today but no change.
    Any one else having this annoying problem. Seems like a software glitch to me.

    http://www.microsoft.com/mac/support
    http://answers.microsoft.com/en-us/mac/forum/macword?auth=1
    http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macword/microsoft-wor d-for-mac-2011-will-not-open-error/ecc42616-6f49-40bb-b8f5-e21c711ea359

  • Changing a Mouse pointer

    I would like to be able to change my mouse pointer to something other that what set_application_property cursor_style can do for me. I would like to be able to call a mouse pointer from the file system and replace the the pointer in my forms app.
    Thanks in advance for any direction that can be given.

    Guys...
    I need some help!!
    Was the question not clear??
    Does it need a rephrasing???

  • Disable the mouse pointer icon!

    As in the title, is there a way to disable the mouse pointer
    icon, ie when you rollover the button it changes to the "finger". I
    dont want to see the "finger" I just want it to remain as the
    "arrow"

    quote:
    Originally posted by:
    Newsgroup User
    I guess you never noticed how your OS works??? The pointer
    stays a pointer
    over all buttons. I find the finger pointer rather useless as
    well.
    Well, I must by now reply to all of you.
    First, "urami" made a good point when referring to kiosk
    interfaces. It makes sense to have no roll over in this case and I
    fully agree with this statement.
    But in the case of the interfaces we commonly create in Flash
    we need the finger icon to indicate that there is a photo-button or
    a drawing-button or a clickable text here and, if we want to "hide"
    it or if we do not want the user click it, we can with simple
    functions (related to _x and _y mouse position) disable or enable
    depending the circumstances the hot spot when the pointer rolls
    over it.
    The quoted remark of "DMennenoh" is not relevant.
    Why? Simply because in the OS all buttons are clearly
    designed as... buttons! There is no need to change the pointer icon
    as we perfectly know what we are going to do and where we must move
    the pointer to do the action: Open, Save, etc. And it is not only
    the case for buttons, it's also the case for the menu bar...
    In the interfaces we design, it is not always the case.
    In all my interfaces, I always have in mind these:
    How shall I react if I see this interface for the first time?
    What can I do and where?
    I suppose you'll agree with me if I say that some interfaces
    are so bad that it is very helpful to have the finger icon just to
    indicate that the area under the pointer is clearly a hot spot...
    I think this discussion is far from ending...

  • After updated software on mac mini with os x 10.7.5 and restart the mouse pointer after about 30 sec. converted to the rainbow wheel and I can't control the computer.

    After updated software on mac mini with os x 10.7.5 and restart the mouse pointer after about 30 sec. converted to the rainbow wheel and I can't control the computer. The rainbow wheel was runnig 8 hrs and I turn off mac mini by power button, then I turn on mac mini with key Shift and p/w, checked HD. My HD has
    capacity 499.25 GB used 86.91GB. Is there a solution to fix this problem axcept the reinstall os?

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac.  
    These steps are to be taken while booted in safe mode.
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below to select it:
    for k in /Sy*/L*/Ex*/{,.?}*.kext; do test -f "$k/Contents/Info.plist" && /usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$_" | egrep -qv "apple|Accusys|ArcMSR|ATTO|CalDigit|HighPoint|hp-fax|JMicron|print|SoftRAID|stex" && echo $k; done | open -f -a TextEdit
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    sudo defaults read com.apple.loginwindow LoginHook | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3 
    Repeat with this line:
    ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null | open -f -a TextEdit
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 4
    osascript -e 'tell application "System Events" to get name of every login item' 2> /dev/null | open -f -a TextEdit 
    Remember, Steps 1-4 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • I updated my iMac to lion and now when i leave my desktop and it goes into stand by it like a picture is taken of the screen and when i want to log in the mouse point removes pixels so i can get to the user login screen this never happened ith snow leopar

    i upgraded my iMac to lion and now when i leave my desktop and it goes into stand by mode, its like a picture is taken of the actice desktop and when i want to log in the mouse point removes pixels so i can get to the user login screen this never happened ith snow leopard. does anyone else experience this and is there a fix?

    I have an iMac 8, 1 that I upgraded Leopard to Snow Leopard.  It was totally updated with the latest from Apple when I bought and tried installing Lion.  The upgrade failed, shot my OS and I couldn't boot.  Had the constant spinner on a grey screen..  did a format of the drive, hdd repair and everything came back clean... got back to Snow Leopard and all the updates on it again and then retried the Lion thing... same bs... dead duck.  Crashed my system one too many times.  I can't see where a few small changes, mostly app related can be classified as an OS upgrade and is not compatible with my iMac.  I have the stuff running on my Mac Pro but have yet to notice anything impressive.  I've always used F3 and really didn't require Mission Control.  Just open you app folder for launch pad... duh?  I use the hot corners anyhow.  As far as Safari is concerned... as a power user, Apple missed the boat on that for me.. full screen etc.. Wow.  I don't like the new Mail either..
    As you can see/read, I'm less than impressed with this release from Apple but I own so many of their products that I will have to put up with it for now... somehow the MS logo should apply to this release Steve.

  • When a link is rolled over by the mouse pointer a very annoying pop up with the link address shows up. There seems to be no way to prevent this from happening. How can this pop up be made to go away?

    no matter what website, every time I move the mouse pointer over something to click on a line of black printing in a thin white box pops up at the bottom of the screen and shows me the http address of the item I'm about to click on. I want to shut this function off or remove it if possible. I find that the previous version did not do this, it seems to be unique to 6.0. It's VERY distracting and ANNOYING. How can I make it go away????

    When you hover the mouse cursor over any link, it will display the link details at the bottom left of the screen; black font on white background.
    This display can be very important as it shows the full address of the hyperlink. This can be particulary useful for checking on whether the link is bona-fida. For example; if you receive an email that looks like it is from a bank , hovering over the link will indicate instantly that the link is pretending to be something it isn't.
    Another example that can be useful; a website link may say 'contact me' rather than give the actual email address. However, when you hover over the link, the actual email address will be displayed at the bottom of the screen. If you click on the link then Outlook usually opens, however I do not use Outlook, so displaying the email address is useful.
    This display is something that has always been present and it is also displayed if you use IE.
    However, I can see that this annoys you, so you could try the following:
    [[https://addons.mozilla.org/en-US/firefox/addon/link-location-bar/?src=api]]
    After installing the addon, you will need to restart Firefox, then go to History and Restore previous session to get all your tabs and webpages back.
    You will now find that when you hover over any link, it will now display in your address bar on the right hand side.
    If this helps, please say this question has been solved.

  • Why doesn't siri know how to change the time of a reminder? When asked, "Do you want to confirm or cancel your reminder?" Reply, "Can I change the time to a half hour later?" Siri doesn't know how to respond.

    Why doesn't siri know how to change the time of a reminder? When asked, "Do you want to confirm or cancel your reminder?" Reply, "Can I change the time to a half hour later?" Siri doesn't know how to respond.

    Hi
    In iMovie'11 (version 9.0.x)
    on top menu row - Apple/iMovie/File/Edit/Cut (Can vary dep. on language - in Swedish Apple/iMovie/Arkiv/Redigera/Klipp . . . )
    down Cut menu - Slow playback/Raspid Playback/Re-play in Slow Motion and onvards
    Here one can select the Pre-Set speeds
    Are you familiar with getting 'inspector' to run?
    No - but I guess that Double Click on clip/sequense or ctrl-Click on it might open it.
    Yours Bengt W

Maybe you are looking for

  • Problem with receiver mail adapter

    Hi All, I have a proxy to mail scenario. I am using mail message format from service market place. Now this is the xml after executing mapping: <Mail> <Subject>XYZ</Subject> <From>From_email</From> <To>To_email</To> <Reply_To /> <Content_Type>text;ch

  • How to reset the Messages app on my imac?

    Hello!  I've tried a lot of the solutions presented here and either I'm doing something wrong or I don't understand the instructions to reset the messages app.  All I need to do is delete an icloud account from it.  Please help!  Thank you!!

  • Downloading a single rule set out of N rule sets.

    HI All, We have defined 4 Rule sets for one particular system. Out of these one is the global rule set. Now, my requirement is to have oe more rule set, with 80% rules from global and then add the rest 20% myself. Would like to know if there is any w

  • [svn:fx-trunk] 11966: Move focusSkinExclusions into Skin (from SparkSkin) and add suggestedFocusSkinExclusions to SkinnableComponent.

    Revision: 11966 Revision: 11966 Author:   [email protected] Date:     2009-11-18 16:21:41 -0800 (Wed, 18 Nov 2009) Log Message: Move focusSkinExclusions into Skin (from SparkSkin) and add suggestedFocusSkinExclusions to SkinnableComponent. QE Notes: N

  • Error when trying to burn DVD

    Hi I get this error (repeatedly) when trying to burn DVD recently. Error code 0x80020022 Burning disc failed because communication to the disc drive failed. It's self explanatory I know, but what am I supposed to do about it? Is it a problem with my