Created
December 7, 2015 16:54
-
-
Save anonymous/9ee8f2164c258c1a2b5f to your computer and use it in GitHub Desktop.
Simple JProgressBar test showing high CPU usage on MacOS/Aqua L&F.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are facing the same problem.
Is this being reported as bug ?