<Swing Dev> Bug 6306075

Paulo Levi i30817 at gmail.com
Sun Jun 10 04:01:07 UTC 2012

A old simple bug that probably causes a lot of pain:
ProgressMonitor.setMaximum only works during construction, not while the
component is in operation.
The bizarre workaround (in a periodic eventqueue runnable)
            int current = getProgress();
            JComponent root = (JComponent)
            GroupLayout l = (GroupLayout) root.getLayout();
            JProgressBar old = view.progressBar;
            view.progressBar = new JProgressBar(current, size);
            l.replace(old, view.progressBar);

Actually ProgressMonitor is a strange component, because it is almost
broken by design. It uses it's methods outside of the EDT (i know this from
a swing detection library), and requires the code that initiates
construction to start it from outside the EDT (the actual construction,
being in the EDT) - this is because since setVisible is blocking for
dialogs, the thing that is being measured can't be on the same thread.
Also, there is yet another thread involved in the creation, due to some
tasks requiring a lot of time to get the extent or give up; like in a url.

Could you fix these problems? (the last 2 are not 'problems' per-se, just
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20120610/d7bd3a75/attachment.html>

More information about the swing-dev mailing list