title: Translucent JFrame leaves rendering artifacts when frame repacked
body: <p>When I change a JLabel's font size or contents in a translucent JFrame, then call pack() on the frame, a ghosted version of the previous contents is visible. This only happens on macOS. The same code works fine on Windows.</p>
  
  <p>Here's an enlarged example of what happens: 
  <a href="https://i.stack.imgur.com/oDDJU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oDDJU.png" alt="enter image description here"></a></p>
  
  <p>Here is code to reproduce the problem; make sure the JFrame is on top of a white background to better see the problem, then click the "Bigger" and "Smaller" buttons:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.event.ActionEvent;
  
  public class ScratchSpace {
  
      public static void main(String[] args) {
          SwingUtilities.invokeLater(() -&gt; {
              JFrame frame = new JFrame("Test Transparent Frame");
              frame.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", true);
              frame.setUndecorated(true);
              frame.setBackground(new Color(0, 0, 0, 25));
  
              JPanel contentPane = new JPanel(new FlowLayout());
              contentPane.setOpaque(false);
              contentPane.setBackground(new Color(0, 0, 0, 25));
  
              JLabel label = new JLabel("Hello cruel world");
              label.setForeground(Color.WHITE);
              contentPane.add(label);
  
              contentPane.add(new JButton(new AbstractAction("Bigger") {
                  @Override
                  public void actionPerformed(ActionEvent e) {
                      label.setFont(label.getFont().deriveFont(label.getFont().getSize() + 1f));
                      frame.pack();
                  }
              }));
              contentPane.add(new JButton(new AbstractAction("Smaller") {
                  @Override
                  public void actionPerformed(ActionEvent e) {
                      label.setFont(label.getFont().deriveFont(label.getFont().getSize() - 1f));
                      frame.pack();
                  }
              }));
  
              frame.setContentPane(contentPane);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              frame.setVisible(true);
          });
      }
  }
  </code></pre>
  
  <p>I've tried changing all components to non-opaque. I've tried revalidating the content pane after packing. What do I need to do to solve this?</p>