I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5.
I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though.
When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have to write all the dialog code myself.
How can I get the cursor to appear?
Here's the simplest code I could create to demonstrate the problem:
import javax.swing.*;
import java.awt.*;
public class CursorTest {
public static void main(String[] args) {
JLabel label = new JLabel("Move mouse here for hand cursor");
label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
JOptionPane pane = new JOptionPane(label);
pane.setOptions(new Object[]{"OK"});
JDialog dialog = pane.createDialog(null, "Test Dialog");
dialog.setVisible(true);
}
}