I am trying to combine 2 JProgressBars together so that I can represent statistics about a single thing.
My question is how could the two progress bars be combined or overlayed such that this would work?
One solution I came up with is to put 2 progress bars together in a JPanel:
But this is not an ideal solution.
Instead what I would like to do is make the top progress bar opaque and then overlap it. I believe that with components it is possible to .add()
a second JProgressBar to the first. But when I added it I only can see the top bar. And even when I set it to be opaque
it still does not show both of them.
bar1.setOpaque(false);
bar1.setBorder(null);
bar2.add(bar1);
It seems that it should be very easy so I must be missing some critical line of code.