waitbar color, 2016a is broken red; how to set to older continuous green?
9 views (last 30 days)
Show older comments
Commented: Walter Roberson on 3 Oct 2016
In 2016a waitbar had red color with discrete marks. Older version is continuous green bar.
How to set the waitbar to the old fashion?
Walter Roberson on 1 Jul 2016
waitbar() creates a figure. In R2016a (did not check other HG2 implementations), that figure has a hidden member in Children which is a JavaWrapper . That JavaWrapper has a JavaPeer which is a javax.swing.JProgressBar which is what is doing the real work. There is no foreground color property above that level.
I have difficulty chasing below that level as I am not very familiar with Java. On my system if I use getForeground on the JavaPeer then the result is java.awt.Color[r=255,g=0,b=0] which would be full red -- but in fact on my system, OS-X El Capitan, the actual color for my progress bars is blue. I can construct a new color and use setForeground on the JavaPeer but it makes no difference. If I use getGraphics on the JavaPeer, and getColor on the result of that, I get told java.awt.SystemColor[i=9] but I have not been able to figure out how the i=9 translates into colors. Meanwhile getBackground on the getGraphics replies with com.apple.laf.AquaImageFactory$SystemColorProxy[r=238,g=238,b=238] which is plausible for the background I observe.
Walter Roberson on 3 Oct 2016
In R2016b on Windows 10, the default foreground color is green.
When I used the lines shown above, I was not able to change the background color (which I was able to change on OS-X.) On the other hand, I could then do
wbc(1).JavaPeer.setForeground( wbc(1).JavaPeer.getBackground.cyan )
to end up with the foreground being cyan (where-as on OS-X I was not able to change the foreground.)
The setStringPainted was important: when it is false, the default color is used.
More Answers (2)
Find more on Dialog Boxes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!