Unable to set mouse cursor JLayeredPane

Posted by Ones3k2 on Stack Overflow See other posts from Stack Overflow or by Ones3k2
Published on 2010-06-03T21:10:27Z Indexed on 2010/06/03 21:14 UTC
Read the original article Hit count: 316

Filed under:
|
|

I'm running into a problem that I can't seem to figure out nor find the answer anywhere on the web.

I've got a JLayeredPane and when it only has one child Panel I am able to correctly set the cursor using setCursor(). The cursor shows up and everything is fine. But when I add an additional JPanel into the JLayeredPane the cursor no longer shows up

for example this works:

m_layeredPane = new JLayeredPane();
m_layeredPane.setLayout(new WBLayoutManager());
m_layeredPane.add(m_mediaPanel, new Integer(0));
// m_layeredPane.add(m_whiteboardPanel, new Integer(1));

m_layeredPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); // WORKS

but this doesn't:

m_layeredPane = new JLayeredPane();
m_layeredPane.setLayout(new WBLayoutManager());
m_layeredPane.add(m_mediaPanel, new Integer(0));
m_layeredPane.add(m_whiteboardPanel, new Integer(1));

m_layeredPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); // FAILS

Anyone know how i can get custom cursors working within a JLayeredPane

© Stack Overflow or respective owner

Related posts about java

Related posts about swing