Swing JDialog wrong cursor shapes

Discussion in 'Java' started by FutureScalper, May 17, 2010.

  1. Hi,

    Using Swing, JRE 1.6 latest versions running under Java Web Start, not
    that it should make any difference...

    Problem is, my cursors sometimes do not revert to the standard mouse
    cursor shapes when they should do so. I can resize a JDialog and
    99.9% of the time, there's no issue, but once the default cursor is
    lost, it retains some other shape and looks bad, although it works of
    course if you can figure out the "hot" pixel location on the alternate
    cursor shape.

    I've tolerated this issue for a long while, and am about to implement
    a watchdog cursor fixer task which knows about all of my JDialogs and
    fixes their cursors to the default cursor periodically.

    I already have to do this with my JFrames, as the cursor gets
    "permanently messed up" sometimes.

    I might have a "corner cursor" shape which persists. Making the
    window or dialog invisible and then visible again doesn't fix it.
    It's hard to use one of those cursors as a pointer, and it's ugly.

    So, do I NEED to implement this "watchdog cursor fixer" thread or
    not? It's not that it would be that difficult, just annoying.

    Anyone else have issues with Swing cursors? By the way, I have
    DirectX disabled, and am using only Java2D graphics on Windows.
    I have Nvidia graphics cards and 4 physical displays, so this isn't
    just on a single monitor system, not that it's relevant.
    It's a Core I7 system, but I've had this problem over the months and
    years with Swing.

    Thanks !!
    FutureScalper, May 17, 2010
    1. Advertisements

  2. JFrame#setCursor(int cursorType), inherited from Frame, is deprecated.
    Component#setCursor(Cursor cursor) has been reliable for me in
    maintaining the cursor over assorted JPanels on many platforms. In this
    example, RCInfo and RCView each have a distinct cursor controlled by a
    MouseListener's mouseEntered() and mouseExited() implementation.

    John B. Matthews, May 18, 2010
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.