I previously posted about a problem I’m encountering with Java/Swing on my Mac - basically cursors stop switching after one switches to another cursor & back. I checked this problem as far back as I had JDKs for - so this issue exists at least as far back as JDK 12. The one thing I don’t know is whether it’s to do with the macOS I am running - Monterey. Unfortunately, I don’t have a machine with BigSur or older. Do any of you? The code to try is very simple:
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final JFrame f = new JFrame(); f.setSize(400, 400); f.setLocationRelativeTo(null); Container c = f.getContentPane(); JPanel p = new JPanel(new BorderLayout()); c.add(p); JButton b1 = new JButton("Busy"); b1.addActionListener((ActionEvent e) -> { f.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }); JButton b2 = new JButton("Normal"); b2.addActionListener((ActionEvent e) -> { f.getGlassPane().setCursor(Cursor.getDefaultCursor()); }); p.add(b1, BorderLayout.NORTH); p.add(b2, BorderLayout.SOUTH); f.setVisible(true); f.getGlassPane().setVisible(true); } }); } After you paste it into any .java file of your choosing (and fixing imports), just run the file, click on the “Busy” button once, then on the “Normal” button, and then one last time on “Busy”. On Linux and Windows, the cursor changes each time. On Mac, the cursor doesn’t change to “Busy” the second time around :-( Unless you guys see anything wrong with this code, I will file a bug report in Oracle’s Bug database. Thanks a bunch, Tom