Skip to content

Instantly share code, notes, and snippets.

Created December 7, 2015 16:54
Show Gist options
  • Save anonymous/9ee8f2164c258c1a2b5f to your computer and use it in GitHub Desktop.
Save anonymous/9ee8f2164c258c1a2b5f to your computer and use it in GitHub Desktop.
Simple JProgressBar test showing high CPU usage on MacOS/Aqua L&F.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ProgressBarTest extends JFrame {
private final JProgressBar progressBar = new JProgressBar();
private final JButton button = new JButton("Toggle Progress Bar State");
public ProgressBarTest() {
initComponents();
}
private void initComponents() {
button.setText("Toggle Progress Bar State");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
progressBar.setIndeterminate(!progressBar.isIndeterminate());
}
});
getContentPane().add(progressBar, BorderLayout.NORTH);
getContentPane().add(button, BorderLayout.SOUTH);
pack();
}
public static void main(String args[]) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new ProgressBarTest().setVisible(true);
}
});
}
}
@saurav28
Copy link

We are facing the same problem.
Is this being reported as bug ?

@eirikbakke
Copy link

Writing up the bug report now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment