When using ThermometerPlot class, how can i see the transition of the
mercury?
i'm programming a thermometer whit JFreeChart, but i don't want to see it
showing just one value... i need to put a final value into a JTextField
(then press a button) and see how the mercury goes from 0º to than final
value, i want to see how the mercury goes up.
I've made a FOR (from 0 to the final value) whith a Thread.sleep(500), and
then update the dataset value with the index in the FOR, but it doesn't
show me the transition, it completes the FOR and finally returns the
thermometer showing the final value. I tried to refresh the chart but it
didn't work.
The code in my button
final JButton btnAccept = new JButton("Accept");
btnAceptar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
for(int i = 0; i <= 40; i++) {
try {
Thread.sleep(500);
}
catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
dataset.setValue(i);
}
}
});
panel.add(btnAceptar);
No comments:
Post a Comment