SwingWorker#setProgress throws an IllegalArgumentException if the argument isn’t from 0 to 100. I thought the main purpose of the setProgress method was to update a JProgressBar (as it was in this tutorial). If that’s the case, why limit the SwingWorker‘s progress to [0, 100] when JProgressBar‘s progress is not limited?
SwingWorker#setProgress throws an IllegalArgumentException if the argument isn’t from 0 to 100. I thought
Share
To the extent that this question has a constructive answer, the notion of what constitutes progress is probably best known to whatever is being modeled in the background thread. Scaling limits the amount of detail that must be exposed.
At the same time,
SwingWorkeris intended to be sub-classed. Nothing precludes adding asetProgress(int progress, in min, int max)method and the attendant property change support, but it’s hard to see any advantage—the recipient would just have to scale it for display.