Skip to main content

JProgressBar indeterminate animation timer

1 reply [Last post]
byhisdeeds
Offline
Joined: 2006-01-06

I'm trying to change the animation timer for a JProgressBar set to the indeterminate mode. I set the following before I create it.

javax.swing.UIManager.put("ProgressBar.repaintInterval", new Integer(1000));
javax.swing.UIManager.put("ProgressBar.cycleTime", new Integer(16000));

But there is no change in the animation. I have the synth look and feel enabled, and am wondering if that has some effect.

Can anybody see what I'm doing wrong.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
leouser
Offline
Joined: 2005-12-12

on a Mustang it defiantely has an effect for me. Try this code out:
import javax.swing.*;

public class JProgressBarTest implements Runnable{

public void run(){
//javax.swing.UIManager.put("ProgressBar.repaintInterval", new Integer(1000));
javax.swing.UIManager.put("ProgressBar.cycleTime", new Integer(16000));
JProgressBar jpb = new JProgressBar(0, 1000);
jpb.setIndeterminate(true);
JFrame jf = new JFrame();
jf.add(jpb);
jf.pack();
jf.setVisible(true);
}

public static void main(String ... args){
if(args.length > 0){
try{
int i = Integer.parseInt(args[0]);
if(i == 0) UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
else if(i == 1)UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");

}
catch(Exception x){}
}
SwingUtilities.invokeLater(new JProgressBarTest());
}

}

-----------
I see a difference in Metal, GTK and Motif. Looking at the Synth, it subclasses BasicProgressBarUI so Im not sure why it isn't having an impact.

leouser